From ed8b073e548938174406bf7d00a6490124d5cc2b Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 16 Aug 2019 14:16:19 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=82=84?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E3=81=8C=E3=81=8D=E3=81=A1?= =?UTF-8?q?=E3=82=93=E3=81=A8=E8=A8=AD=E5=AE=9A=E3=81=95=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=20(#5265)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: og:site_nameがbase系ページに正しく反映さんれない * instanceNameはAPIのmetaじゃなくてog:site_nameを参照するように * Fix: タイトルが変更されるページから通常ページに遷移してもタイトルが戻らない * Fix: タイトルが戻らない mobile / notifications * Fix: faviconの変更が効かないページがある --- src/client/app/common/views/pages/explore.vue | 6 +++++- src/client/app/common/views/pages/favorites.vue | 4 ++++ src/client/app/common/views/pages/featured.vue | 4 ++++ src/client/app/common/views/pages/pages.vue | 3 +++ src/client/app/common/views/pages/user-groups.vue | 2 ++ src/client/app/common/views/pages/user-lists.vue | 2 ++ src/client/app/desktop/views/home/timeline.vue | 2 ++ src/client/app/desktop/views/pages/settings.vue | 3 +++ src/client/app/mios.ts | 7 ++++++- src/client/app/mobile/views/pages/notifications.vue | 3 +++ src/server/web/index.ts | 7 +++++-- 11 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/client/app/common/views/pages/explore.vue b/src/client/app/common/views/pages/explore.vue index f28760e516..507b0638b9 100644 --- a/src/client/app/common/views/pages/explore.vue +++ b/src/client/app/common/views/pages/explore.vue @@ -143,7 +143,11 @@ export default Vue.extend({ this.$root.getMeta().then(meta => { this.meta = meta; }); - } + }, + + mounted() { + document.title = this.$root.instanceName; + }, }); diff --git a/src/client/app/common/views/pages/favorites.vue b/src/client/app/common/views/pages/favorites.vue index 36403dde52..e396615a93 100644 --- a/src/client/app/common/views/pages/favorites.vue +++ b/src/client/app/common/views/pages/favorites.vue @@ -40,5 +40,9 @@ export default Vue.extend({ icon: faStar }); }, + + mounted() { + document.title = this.$root.instanceName; + }, }); diff --git a/src/client/app/common/views/pages/featured.vue b/src/client/app/common/views/pages/featured.vue index 161511998f..c00361aa85 100644 --- a/src/client/app/common/views/pages/featured.vue +++ b/src/client/app/common/views/pages/featured.vue @@ -40,5 +40,9 @@ export default Vue.extend({ icon: faNewspaper }); }, + + mounted() { + document.title = this.$root.instanceName; + }, }); diff --git a/src/client/app/common/views/pages/pages.vue b/src/client/app/common/views/pages/pages.vue index d0a56ac2fa..236330db46 100644 --- a/src/client/app/common/views/pages/pages.vue +++ b/src/client/app/common/views/pages/pages.vue @@ -52,6 +52,9 @@ export default Vue.extend({ icon: faStickyNote }); }, + mounted() { + document.title = this.$root.instanceName; + }, methods: { create() { this.$router.push(`/i/pages/new`); diff --git a/src/client/app/common/views/pages/user-groups.vue b/src/client/app/common/views/pages/user-groups.vue index a51a5f723f..6501a26061 100644 --- a/src/client/app/common/views/pages/user-groups.vue +++ b/src/client/app/common/views/pages/user-groups.vue @@ -62,6 +62,8 @@ export default Vue.extend({ }; }, mounted() { + document.title = this.$root.instanceName; + this.$root.api('users/groups/owned').then(groups => { this.ownedGroups = groups; }); diff --git a/src/client/app/common/views/pages/user-lists.vue b/src/client/app/common/views/pages/user-lists.vue index 29085935cb..955eef993a 100644 --- a/src/client/app/common/views/pages/user-lists.vue +++ b/src/client/app/common/views/pages/user-lists.vue @@ -33,6 +33,8 @@ export default Vue.extend({ }; }, mounted() { + document.title = this.$root.instanceName; + this.$root.api('users/lists/list').then(lists => { this.fetching = false; this.lists = lists; diff --git a/src/client/app/desktop/views/home/timeline.vue b/src/client/app/desktop/views/home/timeline.vue index b870395c18..224b937997 100644 --- a/src/client/app/desktop/views/home/timeline.vue +++ b/src/client/app/desktop/views/home/timeline.vue @@ -94,6 +94,8 @@ export default Vue.extend({ }, mounted() { + document.title = this.$root.instanceName; + (this.$refs.tl as any).$once('loaded', () => { this.$emit('loaded'); }); diff --git a/src/client/app/desktop/views/pages/settings.vue b/src/client/app/desktop/views/pages/settings.vue index 7aba863b7c..29188277f4 100644 --- a/src/client/app/desktop/views/pages/settings.vue +++ b/src/client/app/desktop/views/pages/settings.vue @@ -13,6 +13,9 @@ export default Vue.extend({ components: { XSettings: () => import('../components/settings.vue').then(m => m.default) }, + mounted() { + document.title = this.$root.instanceName; + }, }); diff --git a/src/client/app/mios.ts b/src/client/app/mios.ts index cb25eaa83d..085a327599 100644 --- a/src/client/app/mios.ts +++ b/src/client/app/mios.ts @@ -28,7 +28,12 @@ export default class MiOS extends EventEmitter { }; public get instanceName() { - return this.meta ? (this.meta.data.name || 'Misskey') : 'Misskey'; + const siteName = document.querySelector('meta[property="og:site_name"]') as HTMLMetaElement; + if (siteName && siteName.content) { + return siteName.content; + } + + return 'Misskey'; } private isMetaFetching = false; diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue index e71a855d56..24f8f79ccc 100644 --- a/src/client/app/mobile/views/pages/notifications.vue +++ b/src/client/app/mobile/views/pages/notifications.vue @@ -25,6 +25,9 @@ export default Vue.extend({ faBell, }; }, + mounted() { + document.title = this.$root.instanceName; + }, methods: { beforeInit() { Progress.start(); diff --git a/src/server/web/index.ts b/src/server/web/index.ts index 6c41bbde46..50f006e345 100644 --- a/src/server/web/index.ts +++ b/src/server/web/index.ts @@ -164,7 +164,8 @@ router.get('/@:user', async (ctx, next) => { await ctx.render('user', { user, profile, me, - instanceName: meta.name || 'Misskey' + instanceName: meta.name || 'Misskey', + icon: meta.iconUrl }); ctx.set('Cache-Control', 'public, max-age=30'); } else { @@ -197,7 +198,8 @@ router.get('/notes/:note', async ctx => { await ctx.render('note', { note: _note, summary: getNoteSummary(_note), - instanceName: meta.name || 'Misskey' + instanceName: meta.name || 'Misskey', + icon: meta.iconUrl }); if (['public', 'home'].includes(note.visibility)) { @@ -283,6 +285,7 @@ router.get('*', async ctx => { await ctx.render('base', { img: meta.bannerUrl, title: meta.name || 'Misskey', + instanceName: meta.name || 'Misskey', desc: meta.description, icon: meta.iconUrl });