+ const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
+ return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
+ }
+
+ static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
+ const [ account, channel ] = await Promise.all([
+ AccountModel.loadByNameWithHost(nameWithHost),
+ VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
+ ])
+
+ return this.getAccountOrChannelHTMLPage(() => Promise.resolve(account || channel), req, res)
+ }
+
+ static async getEmbedHTML () {
+ const path = ClientHtml.getEmbedPath()
+
+ // Disable HTML cache in dev mode because webpack can regenerate JS files
+ if (!isTestOrDevInstance() && ClientHtml.htmlCache[path]) {
+ return ClientHtml.htmlCache[path]
+ }
+
+ const buffer = await readFile(path)
+ const serverConfig = await ServerConfigManager.Instance.getHTMLServerConfig()
+
+ let html = buffer.toString()
+ html = await ClientHtml.addAsyncPluginCSS(html)
+ html = ClientHtml.addCustomCSS(html)
+ html = ClientHtml.addTitleTag(html)
+ html = ClientHtml.addDescriptionTag(html)
+ html = ClientHtml.addServerConfig(html, serverConfig)
+
+ ClientHtml.htmlCache[path] = html
+
+ return html