This commit is contained in:
syuilo 2018-09-20 17:21:16 +09:00
parent de0882fab3
commit 3d4983b381
6 changed files with 75 additions and 3 deletions

View file

@ -14,6 +14,14 @@
</div> </div>
<div class="form"> <div class="form">
<div>
<label>
<p>%i18n:@banner-url%</p>
<input v-model="bannerUrl">
</label>
<button class="ui" @click="updateMeta">%i18n:@save%</button>
</div>
<div> <div>
<label> <label>
<input type="checkbox" v-model="disableRegistration" @change="updateMeta"> <input type="checkbox" v-model="disableRegistration" @change="updateMeta">
@ -46,6 +54,7 @@ export default Vue.extend({
stats: null, stats: null,
disableRegistration: false, disableRegistration: false,
disableLocalTimeline: false, disableLocalTimeline: false,
bannerUrl: null,
inviteCode: null, inviteCode: null,
connection: null, connection: null,
connectionId: null connectionId: null
@ -58,6 +67,7 @@ export default Vue.extend({
(this as any).os.getMeta().then(meta => { (this as any).os.getMeta().then(meta => {
this.disableRegistration = meta.disableRegistration; this.disableRegistration = meta.disableRegistration;
this.disableLocalTimeline = meta.disableLocalTimeline; this.disableLocalTimeline = meta.disableLocalTimeline;
this.bannerUrl = meta.bannerUrl;
}); });
(this as any).api('stats').then(stats => { (this as any).api('stats').then(stats => {
@ -76,7 +86,8 @@ export default Vue.extend({
updateMeta() { updateMeta() {
(this as any).api('admin/update-meta', { (this as any).api('admin/update-meta', {
disableRegistration: this.disableRegistration, disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline disableLocalTimeline: this.disableLocalTimeline,
bannerUrl: this.bannerUrl
}); });
} }
} }
@ -114,6 +125,7 @@ export default Vue.extend({
> .form > .form
> div > div
padding 16px
border-bottom solid 1px #eee border-bottom solid 1px #eee
</style> </style>

View file

@ -1,5 +1,7 @@
<template> <template>
<div class="mk-welcome"> <div class="mk-welcome">
<div class="banner" :style="{ backgroundImage: banner ? `url(${banner})` : null }"></div>
<button @click="dark"> <button @click="dark">
<template v-if="$store.state.device.darkmode">%fa:moon%</template> <template v-if="$store.state.device.darkmode">%fa:moon%</template>
<template v-else>%fa:R moon%</template> <template v-else>%fa:R moon%</template>
@ -154,6 +156,7 @@ export default Vue.extend({
return { return {
meta: null, meta: null,
stats: null, stats: null,
banner: null,
copyright, copyright,
host, host,
name: 'Misskey', name: 'Misskey',
@ -169,6 +172,7 @@ export default Vue.extend({
this.name = meta.name; this.name = meta.name;
this.description = meta.description; this.description = meta.description;
this.announcements = meta.broadcasts; this.announcements = meta.broadcasts;
this.banner = meta.bannerUrl;
}); });
(this as any).api('stats').then(stats => { (this as any).api('stats').then(stats => {
@ -308,6 +312,26 @@ root(isDark)
//background-position center //background-position center
//background-size cover //background-size cover
> .banner
position absolute
top 0
left 0
width 100%
height 400px
background-position center
background-size cover
opacity 0.7
&:after
content ""
display block
position absolute
bottom 0
left 0
width 100%
height 100px
background linear-gradient(transparent, isDark ? #191b22 : #f7f7f7)
> .forkit > .forkit
position absolute position absolute
top 0 top 0

View file

@ -1,5 +1,7 @@
<template> <template>
<div class="wgwfgvvimdjvhjfwxropcwksnzftjqes"> <div class="wgwfgvvimdjvhjfwxropcwksnzftjqes">
<div class="banner" :style="{ backgroundImage: banner ? `url(${banner})` : null }"></div>
<div> <div>
<img :src="$store.state.device.darkmode ? 'assets/title.dark.svg' : 'assets/title.light.svg'" :alt="name"> <img :src="$store.state.device.darkmode ? 'assets/title.dark.svg' : 'assets/title.light.svg'" :alt="name">
<p class="host">{{ host }}</p> <p class="host">{{ host }}</p>
@ -80,6 +82,7 @@ export default Vue.extend({
meta: null, meta: null,
copyright, copyright,
stats: null, stats: null,
banner: null,
host, host,
name: 'Misskey', name: 'Misskey',
description: '', description: '',
@ -93,6 +96,7 @@ export default Vue.extend({
this.name = meta.name; this.name = meta.name;
this.description = meta.description; this.description = meta.description;
this.announcements = meta.broadcasts; this.announcements = meta.broadcasts;
this.banner = meta.bannerUrl;
}); });
(this as any).api('stats').then(stats => { (this as any).api('stats').then(stats => {
@ -121,7 +125,27 @@ root(isDark)
text-align center text-align center
//background #fff //background #fff
> div > .banner
position absolute
top 0
left 0
width 100%
height 300px
background-position center
background-size cover
opacity 0.7
&:after
content ""
display block
position absolute
bottom 0
left 0
width 100%
height 100px
background linear-gradient(transparent, isDark ? #191b22 : #f7f7f7)
> div:not(.banner)
padding 32px padding 32px
margin 0 auto margin 0 auto
max-width 500px max-width 500px

View file

@ -14,4 +14,5 @@ export type IMeta = {
disableRegistration?: boolean; disableRegistration?: boolean;
disableLocalTimeline?: boolean; disableLocalTimeline?: boolean;
hidedTags?: string[]; hidedTags?: string[];
bannerUrl?: string;
}; };

View file

@ -34,6 +34,12 @@ export const meta = {
'ja-JP': '統計などで無視するハッシュタグ' 'ja-JP': '統計などで無視するハッシュタグ'
} }
}), }),
bannerUrl: $.str.optional.nullable.note({
desc: {
'ja-JP': 'インスタンスのバナー画像URL'
}
}),
} }
}; };
@ -59,6 +65,10 @@ export default (params: any) => new Promise(async (res, rej) => {
set.hidedTags = ps.hidedTags; set.hidedTags = ps.hidedTags;
} }
if (ps.bannerUrl !== undefined) {
set.bannerUrl = ps.bannerUrl;
}
await Meta.update({}, { await Meta.update({}, {
$set: set $set: set
}, { upsert: true }); }, { upsert: true });

View file

@ -38,6 +38,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
driveCapacityPerLocalUserMb: config.localDriveCapacityMb, driveCapacityPerLocalUserMb: config.localDriveCapacityMb,
recaptchaSitekey: config.recaptcha ? config.recaptcha.site_key : null, recaptchaSitekey: config.recaptcha ? config.recaptcha.site_key : null,
swPublickey: config.sw ? config.sw.public_key : null, swPublickey: config.sw ? config.sw.public_key : null,
hidedTags: (me && me.isAdmin) ? meta.hidedTags : undefined hidedTags: (me && me.isAdmin) ? meta.hidedTags : undefined,
bannerUrl: meta.bannerUrl
}); });
}); });