From 6ceff60c1e9eb064fee5fe05ec36b0ffadc8370d Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Mar 2019 16:30:51 +0900 Subject: [PATCH] =?UTF-8?q?Favicon=E3=82=92=E5=8F=AF=E5=A4=89=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=AA=E3=81=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/admin/views/instance.vue | 4 ++++ src/models/meta.ts | 1 + src/server/api/endpoints/admin/update-meta.ts | 11 +++++++++++ src/server/web/index.ts | 5 ++++- src/server/web/views/base.pug | 9 +++++---- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue index ce3ce16f1..16bfb9a36 100644 --- a/src/client/app/admin/views/instance.vue +++ b/src/client/app/admin/views/instance.vue @@ -6,6 +6,7 @@ {{ $t('host') }} {{ $t('instance-name') }} {{ $t('instance-description') }} + {{ $t('icon-url') }} {{ $t('logo-url') }} {{ $t('banner-url') }} {{ $t('error-image-url') }} @@ -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(' '), diff --git a/src/models/meta.ts b/src/models/meta.ts index 9e4468032..5351c17c5 100644 --- a/src/models/meta.ts +++ b/src/models/meta.ts @@ -198,6 +198,7 @@ export type IMeta = { mascotImageUrl?: string; bannerUrl?: string; errorImageUrl?: string; + iconUrl?: string; cacheRemoteFiles?: boolean; diff --git a/src/server/api/endpoints/admin/update-meta.ts b/src/server/api/endpoints/admin/update-meta.ts index 5d08a6e37..df7520917 100644 --- a/src/server/api/endpoints/admin/update-meta.ts +++ b/src/server/api/endpoints/admin/update-meta.ts @@ -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; } diff --git a/src/server/web/index.ts b/src/server/web/index.ts index f83b36437..923ae6902 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -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'); }); diff --git a/src/server/web/views/base.pug b/src/server/web/views/base.pug index a71f94e9c..1d9ff635c 100644 --- a/src/server/web/views/base.pug +++ b/src/server/web/views/base.pug @@ -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