Faviconを可変にするなど

This commit is contained in:
syuilo 2019-03-14 16:30:51 +09:00
parent d762a6ce58
commit 6ceff60c1e
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
5 changed files with 25 additions and 5 deletions

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="iconUrl"><template #icon><fa icon="link"/></template>{{ $t('icon-url') }}</ui-input>
<ui-input v-model="mascotImageUrl"><template #icon><fa icon="link"/></template>{{ $t('logo-url') }}</ui-input>
<ui-input v-model="bannerUrl"><template #icon><fa icon="link"/></template>{{ $t('banner-url') }}</ui-input>
<ui-input v-model="errorImageUrl"><template #icon><fa icon="link"/></template>{{ $t('error-image-url') }}</ui-input>
@ -157,6 +158,7 @@ export default Vue.extend({
mascotImageUrl: null,
bannerUrl: null,
errorImageUrl: null,
iconUrl: null,
name: null,
description: null,
languages: null,
@ -207,6 +209,7 @@ export default Vue.extend({
this.mascotImageUrl = meta.mascotImageUrl;
this.bannerUrl = meta.bannerUrl;
this.errorImageUrl = meta.errorImageUrl;
this.iconUrl = meta.iconUrl;
this.name = meta.name;
this.description = meta.description;
this.languages = meta.langs.join(' ');
@ -267,6 +270,7 @@ export default Vue.extend({
mascotImageUrl: this.mascotImageUrl,
bannerUrl: this.bannerUrl,
errorImageUrl: this.errorImageUrl,
iconImageUrl: this.iconImageUrl,
name: this.name,
description: this.description,
langs: this.languages.split(' '),

View file

@ -198,6 +198,7 @@ export type IMeta = {
mascotImageUrl?: string;
bannerUrl?: string;
errorImageUrl?: string;
iconUrl?: string;
cacheRemoteFiles?: boolean;

View file

@ -69,6 +69,13 @@ export const meta = {
}
},
iconUrl: {
validator: $.optional.nullable.str,
desc: {
'ja-JP': 'インスタンスのアイコンURL'
}
},
name: {
validator: $.optional.nullable.str,
desc: {
@ -356,6 +363,10 @@ export default define(meta, async (ps) => {
set.bannerUrl = ps.bannerUrl;
}
if (ps.iconUrl !== undefined) {
set.iconUrl = ps.iconUrl;
}
if (ps.name !== undefined) {
set.name = ps.name;
}

View file

@ -250,7 +250,10 @@ router.get('/reversi', async ctx => ctx.redirect(override(ctx.URL.pathname, 'gam
router.get('*', async ctx => {
const meta = await fetchMeta();
await ctx.render('base', {
img: meta.bannerUrl
img: meta.bannerUrl,
title: meta.name,
desc: meta.description,
icon: meta.iconUrl
});
ctx.set('Cache-Control', 'public, max-age=300');
});

View file

@ -8,17 +8,18 @@ html
head
meta(charset='utf-8')
meta(name='application-name' content='Misskey')
meta(name='application-name' content= title || 'Misskey')
meta(name='referrer' content='origin')
meta(property='og:site_name' content='Misskey')
meta(property='og:site_name' content= title || 'Misskey')
link(rel='icon' href= icon || '/favicon.ico')
link(rel='manifest' href='/manifest.json')
title
block title
| Misskey
= title || 'Misskey'
block desc
meta(name='description' content='✨🌎✨ A federated blogging platform ✨🚀✨')
meta(name='description' content= desc || '✨🌎✨ A federated blogging platform ✨🚀✨')
block meta