タイトルやアイコンがきちんと設定されないことがあるのを修正 (#5265)

* Fix: og:site_nameがbase系ページに正しく反映さんれない

* instanceNameはAPIのmetaじゃなくてog:site_nameを参照するように

* Fix: タイトルが変更されるページから通常ページに遷移してもタイトルが戻らない

* Fix: タイトルが戻らない mobile / notifications

* Fix: faviconの変更が効かないページがある
This commit is contained in:
MeiMei 2019-08-16 14:16:19 +09:00 committed by syuilo
parent 7dd193636c
commit ed8b073e54
11 changed files with 39 additions and 4 deletions

View File

@ -143,7 +143,11 @@ export default Vue.extend({
this.$root.getMeta().then(meta => {
this.meta = meta;
});
}
},
mounted() {
document.title = this.$root.instanceName;
},
});
</script>

View File

@ -40,5 +40,9 @@ export default Vue.extend({
icon: faStar
});
},
mounted() {
document.title = this.$root.instanceName;
},
});
</script>

View File

@ -40,5 +40,9 @@ export default Vue.extend({
icon: faNewspaper
});
},
mounted() {
document.title = this.$root.instanceName;
},
});
</script>

View File

@ -52,6 +52,9 @@ export default Vue.extend({
icon: faStickyNote
});
},
mounted() {
document.title = this.$root.instanceName;
},
methods: {
create() {
this.$router.push(`/i/pages/new`);

View File

@ -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;
});

View File

@ -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;

View File

@ -94,6 +94,8 @@ export default Vue.extend({
},
mounted() {
document.title = this.$root.instanceName;
(this.$refs.tl as any).$once('loaded', () => {
this.$emit('loaded');
});

View File

@ -13,6 +13,9 @@ export default Vue.extend({
components: {
XSettings: () => import('../components/settings.vue').then(m => m.default)
},
mounted() {
document.title = this.$root.instanceName;
},
});
</script>

View File

@ -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;

View File

@ -25,6 +25,9 @@ export default Vue.extend({
faBell,
};
},
mounted() {
document.title = this.$root.instanceName;
},
methods: {
beforeInit() {
Progress.start();

View File

@ -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
});