mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Inject plugin CSS in embed too
This commit is contained in:
parent
5505981154
commit
cf649c2ed9
3 changed files with 61 additions and 11 deletions
|
@ -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<MAccountActor | MChannelActor>,
|
||||
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('<html>', `<html lang="${paramLang}">`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue