diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-28 10:21:39 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-28 10:22:50 +0200 |
commit | 012580d98f489e599d44a9a2a0bdc892b9455a90 (patch) | |
tree | cd6d4abdbf43f4cd1c051ac49682b97c7b6dca92 /server/lib/client-html.ts | |
parent | d6d96bed80700830063c6055969d2d2ff46c63c6 (diff) | |
download | PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.gz PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.zst PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.zip |
Cleanup
We must not expose private actor objects to clients
Just make 2 GET requests on channel/accounts instead
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 12 |
1 files changed, 5 insertions, 7 deletions
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 { | |||
208 | } | 208 | } |
209 | 209 | ||
210 | static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) { | 210 | static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) { |
211 | const accountModel = await AccountModel.loadByNameWithHost(nameWithHost) | 211 | const [ account, channel ] = await Promise.all([ |
212 | AccountModel.loadByNameWithHost(nameWithHost), | ||
213 | VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost) | ||
214 | ]) | ||
212 | 215 | ||
213 | if (accountModel) { | 216 | return this.getAccountOrChannelHTMLPage(() => Promise.resolve(account || channel), req, res) |
214 | return this.getAccountOrChannelHTMLPage(() => new Promise(resolve => resolve(accountModel)), req, res) | ||
215 | } else { | ||
216 | const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost) | ||
217 | return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res) | ||
218 | } | ||
219 | } | 217 | } |
220 | 218 | ||
221 | static async getEmbedHTML () { | 219 | static async getEmbedHTML () { |