forked from FoundKeyGang/FoundKey
タイトルやアイコンがきちんと設定されないことがあるのを修正 (#5265)
* Fix: og:site_nameがbase系ページに正しく反映さんれない * instanceNameはAPIのmetaじゃなくてog:site_nameを参照するように * Fix: タイトルが変更されるページから通常ページに遷移してもタイトルが戻らない * Fix: タイトルが戻らない mobile / notifications * Fix: faviconの変更が効かないページがある
This commit is contained in:
parent
7dd193636c
commit
ed8b073e54
11 changed files with 39 additions and 4 deletions
|
@ -143,7 +143,11 @@ export default Vue.extend({
|
||||||
this.$root.getMeta().then(meta => {
|
this.$root.getMeta().then(meta => {
|
||||||
this.meta = meta;
|
this.meta = meta;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -40,5 +40,9 @@ export default Vue.extend({
|
||||||
icon: faStar
|
icon: faStar
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,5 +40,9 @@ export default Vue.extend({
|
||||||
icon: faNewspaper
|
icon: faNewspaper
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -52,6 +52,9 @@ export default Vue.extend({
|
||||||
icon: faStickyNote
|
icon: faStickyNote
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
create() {
|
create() {
|
||||||
this.$router.push(`/i/pages/new`);
|
this.$router.push(`/i/pages/new`);
|
||||||
|
|
|
@ -62,6 +62,8 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
|
||||||
this.$root.api('users/groups/owned').then(groups => {
|
this.$root.api('users/groups/owned').then(groups => {
|
||||||
this.ownedGroups = groups;
|
this.ownedGroups = groups;
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,6 +33,8 @@ export default Vue.extend({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
|
||||||
this.$root.api('users/lists/list').then(lists => {
|
this.$root.api('users/lists/list').then(lists => {
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
this.lists = lists;
|
this.lists = lists;
|
||||||
|
|
|
@ -94,6 +94,8 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
|
||||||
(this.$refs.tl as any).$once('loaded', () => {
|
(this.$refs.tl as any).$once('loaded', () => {
|
||||||
this.$emit('loaded');
|
this.$emit('loaded');
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,9 @@ export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
XSettings: () => import('../components/settings.vue').then(m => m.default)
|
XSettings: () => import('../components/settings.vue').then(m => m.default)
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,12 @@ export default class MiOS extends EventEmitter {
|
||||||
};
|
};
|
||||||
|
|
||||||
public get instanceName() {
|
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;
|
private isMetaFetching = false;
|
||||||
|
|
|
@ -25,6 +25,9 @@ export default Vue.extend({
|
||||||
faBell,
|
faBell,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
document.title = this.$root.instanceName;
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
beforeInit() {
|
beforeInit() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
|
|
@ -164,7 +164,8 @@ router.get('/@:user', async (ctx, next) => {
|
||||||
|
|
||||||
await ctx.render('user', {
|
await ctx.render('user', {
|
||||||
user, profile, me,
|
user, profile, me,
|
||||||
instanceName: meta.name || 'Misskey'
|
instanceName: meta.name || 'Misskey',
|
||||||
|
icon: meta.iconUrl
|
||||||
});
|
});
|
||||||
ctx.set('Cache-Control', 'public, max-age=30');
|
ctx.set('Cache-Control', 'public, max-age=30');
|
||||||
} else {
|
} else {
|
||||||
|
@ -197,7 +198,8 @@ router.get('/notes/:note', async ctx => {
|
||||||
await ctx.render('note', {
|
await ctx.render('note', {
|
||||||
note: _note,
|
note: _note,
|
||||||
summary: getNoteSummary(_note),
|
summary: getNoteSummary(_note),
|
||||||
instanceName: meta.name || 'Misskey'
|
instanceName: meta.name || 'Misskey',
|
||||||
|
icon: meta.iconUrl
|
||||||
});
|
});
|
||||||
|
|
||||||
if (['public', 'home'].includes(note.visibility)) {
|
if (['public', 'home'].includes(note.visibility)) {
|
||||||
|
@ -283,6 +285,7 @@ router.get('*', async ctx => {
|
||||||
await ctx.render('base', {
|
await ctx.render('base', {
|
||||||
img: meta.bannerUrl,
|
img: meta.bannerUrl,
|
||||||
title: meta.name || 'Misskey',
|
title: meta.name || 'Misskey',
|
||||||
|
instanceName: meta.name || 'Misskey',
|
||||||
desc: meta.description,
|
desc: meta.description,
|
||||||
icon: meta.iconUrl
|
icon: meta.iconUrl
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue