Make instance logo customisable (#3829)

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

View File

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

View File

@ -6,6 +6,7 @@
<ui-input :value="host" readonly>{{ $t('host') }}</ui-input> <ui-input :value="host" readonly>{{ $t('host') }}</ui-input>
<ui-input v-model="name">{{ $t('instance-name') }}</ui-input> <ui-input v-model="name">{{ $t('instance-name') }}</ui-input>
<ui-textarea v-model="description">{{ $t('instance-description') }}</ui-textarea> <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="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="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> <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, maintainerEmail: null,
disableRegistration: false, disableRegistration: false,
disableLocalTimeline: false, disableLocalTimeline: false,
logoUrl: null,
bannerUrl: null, bannerUrl: null,
errorImageUrl: null, errorImageUrl: null,
name: null, name: null,
@ -196,6 +198,7 @@ export default Vue.extend({
this.maintainerEmail = meta.maintainer.email; this.maintainerEmail = meta.maintainer.email;
this.disableRegistration = meta.disableRegistration; this.disableRegistration = meta.disableRegistration;
this.disableLocalTimeline = meta.disableLocalTimeline; this.disableLocalTimeline = meta.disableLocalTimeline;
this.logoUrl = meta.logoUrl;
this.bannerUrl = meta.bannerUrl; this.bannerUrl = meta.bannerUrl;
this.errorImageUrl = meta.errorImageUrl; this.errorImageUrl = meta.errorImageUrl;
this.name = meta.name; this.name = meta.name;
@ -253,6 +256,7 @@ export default Vue.extend({
maintainerEmail: this.maintainerEmail, maintainerEmail: this.maintainerEmail,
disableRegistration: this.disableRegistration, disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline, disableLocalTimeline: this.disableLocalTimeline,
logoUrl: this.logoUrl,
bannerUrl: this.bannerUrl, bannerUrl: this.bannerUrl,
errorImageUrl: this.errorImageUrl, errorImageUrl: this.errorImageUrl,
name: this.name, name: this.name,

View File

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

View File

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

View File

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

View File

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

View File

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