From cf649c2ed918b3cc6bd4c92f38c7752174ac1e9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 24 Aug 2020 11:25:40 +0200 Subject: Inject plugin CSS in embed too --- server/lib/client-html.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'server/lib') diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 6bc48b5df..9f668dedb 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -171,6 +171,23 @@ export class ClientHtml { return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res) } + static async getEmbedHTML () { + const path = ClientHtml.getEmbedPath() + console.log('coucu') + console.log(path) + + if (ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path] + + const buffer = await readFile(path) + + let html = buffer.toString() + html = await ClientHtml.addAsyncPluginCSS(html) + + ClientHtml.htmlCache[path] = html + + return html + } + private static async getAccountOrChannelHTMLPage ( loader: () => Bluebird, req: express.Request, @@ -252,6 +269,10 @@ export class ClientHtml { return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') } + private static getEmbedPath () { + return join(__dirname, '../../../client/dist/standalone/videos/embed.html') + } + private static addHtmlLang (htmlStringPage: string, paramLang: string) { return htmlStringPage.replace('', ``) } -- cgit v1.2.3