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 :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="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="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="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> <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, mascotImageUrl: null,
bannerUrl: null, bannerUrl: null,
errorImageUrl: null, errorImageUrl: null,
iconUrl: null,
name: null, name: null,
description: null, description: null,
languages: null, languages: null,
@ -207,6 +209,7 @@ export default Vue.extend({
this.mascotImageUrl = meta.mascotImageUrl; this.mascotImageUrl = meta.mascotImageUrl;
this.bannerUrl = meta.bannerUrl; this.bannerUrl = meta.bannerUrl;
this.errorImageUrl = meta.errorImageUrl; this.errorImageUrl = meta.errorImageUrl;
this.iconUrl = meta.iconUrl;
this.name = meta.name; this.name = meta.name;
this.description = meta.description; this.description = meta.description;
this.languages = meta.langs.join(' '); this.languages = meta.langs.join(' ');
@ -267,6 +270,7 @@ export default Vue.extend({
mascotImageUrl: this.mascotImageUrl, mascotImageUrl: this.mascotImageUrl,
bannerUrl: this.bannerUrl, bannerUrl: this.bannerUrl,
errorImageUrl: this.errorImageUrl, errorImageUrl: this.errorImageUrl,
iconImageUrl: this.iconImageUrl,
name: this.name, name: this.name,
description: this.description, description: this.description,
langs: this.languages.split(' '), langs: this.languages.split(' '),

View file

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

View file

@ -69,6 +69,13 @@ export const meta = {
} }
}, },
iconUrl: {
validator: $.optional.nullable.str,
desc: {
'ja-JP': 'インスタンスのアイコンURL'
}
},
name: { name: {
validator: $.optional.nullable.str, validator: $.optional.nullable.str,
desc: { desc: {
@ -356,6 +363,10 @@ export default define(meta, async (ps) => {
set.bannerUrl = ps.bannerUrl; set.bannerUrl = ps.bannerUrl;
} }
if (ps.iconUrl !== undefined) {
set.iconUrl = ps.iconUrl;
}
if (ps.name !== undefined) { if (ps.name !== undefined) {
set.name = ps.name; 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 => { router.get('*', async ctx => {
const meta = await fetchMeta(); const meta = await fetchMeta();
await ctx.render('base', { 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'); ctx.set('Cache-Control', 'public, max-age=300');
}); });

View file

@ -8,17 +8,18 @@ html
head head
meta(charset='utf-8') meta(charset='utf-8')
meta(name='application-name' content='Misskey') meta(name='application-name' content= title || 'Misskey')
meta(name='referrer' content='origin') 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') link(rel='manifest' href='/manifest.json')
title title
block title block title
| Misskey = title || 'Misskey'
block desc block desc
meta(name='description' content='✨🌎✨ A federated blogging platform ✨🚀✨') meta(name='description' content= desc || '✨🌎✨ A federated blogging platform ✨🚀✨')
block meta block meta