From 012580d98f489e599d44a9a2a0bdc892b9455a90 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 May 2021 10:21:39 +0200 Subject: Cleanup We must not expose private actor objects to clients Just make 2 GET requests on channel/accounts instead --- server/lib/client-html.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'server/lib/client-html.ts') diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 2f6bce1c7..3c09332b5 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -208,14 +208,12 @@ class ClientHtml { } static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) { - const accountModel = await AccountModel.loadByNameWithHost(nameWithHost) + const [ account, channel ] = await Promise.all([ + AccountModel.loadByNameWithHost(nameWithHost), + VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost) + ]) - if (accountModel) { - return this.getAccountOrChannelHTMLPage(() => new Promise(resolve => resolve(accountModel)), req, res) - } else { - const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost) - return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res) - } + return this.getAccountOrChannelHTMLPage(() => Promise.resolve(account || channel), req, res) } static async getEmbedHTML () { -- cgit v1.2.3