aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-24 11:25:40 +0200
committerChocobozzz <me@florianbigard.com>2020-08-24 11:25:40 +0200
commitcf649c2ed918b3cc6bd4c92f38c7752174ac1e9a (patch)
tree11f3be3a12ee6f717d1e814e26fa802a8ac871bc /server/lib
parent5505981154195131f961beeba355cc1d173983f7 (diff)
downloadPeerTube-cf649c2ed918b3cc6bd4c92f38c7752174ac1e9a.tar.gz
PeerTube-cf649c2ed918b3cc6bd4c92f38c7752174ac1e9a.tar.zst
PeerTube-cf649c2ed918b3cc6bd4c92f38c7752174ac1e9a.zip
Inject plugin CSS in embed too
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/client-html.ts21
1 files changed, 21 insertions, 0 deletions
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 {
171 return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res) 171 return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res)
172 } 172 }
173 173
174 static async getEmbedHTML () {
175 const path = ClientHtml.getEmbedPath()
176 console.log('coucu')
177 console.log(path)
178
179 if (ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path]
180
181 const buffer = await readFile(path)
182
183 let html = buffer.toString()
184 html = await ClientHtml.addAsyncPluginCSS(html)
185
186 ClientHtml.htmlCache[path] = html
187
188 return html
189 }
190
174 private static async getAccountOrChannelHTMLPage ( 191 private static async getAccountOrChannelHTMLPage (
175 loader: () => Bluebird<MAccountActor | MChannelActor>, 192 loader: () => Bluebird<MAccountActor | MChannelActor>,
176 req: express.Request, 193 req: express.Request,
@@ -252,6 +269,10 @@ export class ClientHtml {
252 return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html') 269 return join(__dirname, '../../../client/dist/' + buildFileLocale(lang) + '/index.html')
253 } 270 }
254 271
272 private static getEmbedPath () {
273 return join(__dirname, '../../../client/dist/standalone/videos/embed.html')
274 }
275
255 private static addHtmlLang (htmlStringPage: string, paramLang: string) { 276 private static addHtmlLang (htmlStringPage: string, paramLang: string) {
256 return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`) 277 return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`)
257 } 278 }