simplify note embed page

This commit is contained in:
kakkokari-gtyih 2023-04-06 11:09:04 +09:00
parent d583d2cafd
commit 4a2955e088
1 changed files with 1 additions and 23 deletions

View File

@ -481,29 +481,7 @@ export class ClientServerService {
reply.removeHeader('X-Frame-Options');
reply.header("X-Robots-Tag", "noindex");
const note = await this.notesRepository.findOneBy({
id: request.params.note,
visibility: In(['public', 'home']),
});
if (note) {
const _note = await this.noteEntityService.pack(note);
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: note.userId });
const meta = await this.metaService.fetch();
reply.header('Cache-Control', 'public, max-age=15');
return await reply.view('note', {
note: _note,
profile,
avatarUrl: await this.userEntityService.getAvatarUrl(await this.usersRepository.findOneByOrFail({ id: note.userId })),
// TODO: Let locale changeable by instance setting
summary: getNoteSummary(_note),
instanceName: meta.name ?? 'Misskey',
icon: meta.iconUrl,
themeColor: meta.themeColor,
});
} else {
return await renderBase(reply);
}
});
// Page