Make instance logo customisable (#3829)

This commit is contained in:
ibrokemypie 2019-01-04 05:02:40 +11:00 committed by syuilo
parent 4c6aa5b3df
commit 2589743e0a
7 changed files with 20 additions and 1 deletions

View file

@ -992,6 +992,7 @@ admin/views/instance.vue:
instance-name: "Instance name"
instance-description: "Instance description"
host: "Host"
logo-url: "Logo image URL"
banner-url: "Banner image URL"
error-image-url: "Error image URL"
languages: "Language of this instance"

View file

@ -6,6 +6,7 @@
<ui-input :value="host" readonly>{{ $t('host') }}</ui-input>
<ui-input v-model="name">{{ $t('instance-name') }}</ui-input>
<ui-textarea v-model="description">{{ $t('instance-description') }}</ui-textarea>
<ui-input v-model="logoUrl"><i slot="icon"><fa icon="link"/></i>{{ $t('logo-url') }}</ui-input>
<ui-input v-model="bannerUrl"><i slot="icon"><fa icon="link"/></i>{{ $t('banner-url') }}</ui-input>
<ui-input v-model="errorImageUrl"><i slot="icon"><fa icon="link"/></i>{{ $t('error-image-url') }}</ui-input>
<ui-input v-model="languages"><i slot="icon"><fa icon="language"/></i>{{ $t('languages') }}<span slot="desc">{{ $t('languages-desc') }}</span></ui-input>
@ -149,6 +150,7 @@ export default Vue.extend({
maintainerEmail: null,
disableRegistration: false,
disableLocalTimeline: false,
logoUrl: null,
bannerUrl: null,
errorImageUrl: null,
name: null,
@ -196,6 +198,7 @@ export default Vue.extend({
this.maintainerEmail = meta.maintainer.email;
this.disableRegistration = meta.disableRegistration;
this.disableLocalTimeline = meta.disableLocalTimeline;
this.logoUrl = meta.logoUrl;
this.bannerUrl = meta.bannerUrl;
this.errorImageUrl = meta.errorImageUrl;
this.name = meta.name;
@ -253,6 +256,7 @@ export default Vue.extend({
maintainerEmail: this.maintainerEmail,
disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline,
logoUrl: this.logoUrl,
bannerUrl: this.bannerUrl,
errorImageUrl: this.errorImageUrl,
name: this.name,

View file

@ -35,7 +35,7 @@
<span class="signin" @click="signin">{{ $t('signin') }}</span>
</p>
<img src="/assets/ai.png" alt="" title="藍" class="char">
<img :src="meta.logoUrl || '/assets/ai.png'" alt="" title="藍" class="char">
</div>
</div>

View file

@ -19,6 +19,7 @@ const defaultMeta: any = {
enableExternalUserRecommendation: false,
externalUserRecommendationEngine: 'https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-misskey-api.cgi?{{host}}+{{user}}+{{limit}}+{{offset}}',
externalUserRecommendationTimeout: 300000,
logoUrl: '/assets/ai.png',
errorImageUrl: 'https://ai.misskey.xyz/aiart/yubitun.png',
enableServiceWorker: false
};

View file

@ -185,6 +185,7 @@ export type IMeta = {
disableRegistration?: boolean;
disableLocalTimeline?: boolean;
hidedTags?: string[];
logoUrl?: string;
bannerUrl?: string;
errorImageUrl?: string;

View file

@ -39,6 +39,13 @@ export const meta = {
}
},
logoUrl: {
validator: $.str.optional.nullable,
desc: {
'ja-JP': 'インスタンスロゴ画像のURL'
}
},
bannerUrl: {
validator: $.str.optional.nullable,
desc: {
@ -328,6 +335,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.hidedTags = ps.hidedTags;
}
if (ps.logoUrl !== undefined) {
set.logoUrl = ps.logoUrl;
}
if (ps.bannerUrl !== undefined) {
set.bannerUrl = ps.bannerUrl;
}

View file

@ -65,6 +65,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
enableRecaptcha: instance.enableRecaptcha,
recaptchaSiteKey: instance.recaptchaSiteKey,
swPublickey: instance.swPublicKey,
logoUrl: instance.logoUrl,
bannerUrl: instance.bannerUrl,
errorImageUrl: instance.errorImageUrl,
maxNoteTextLength: instance.maxNoteTextLength,