1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

WIP plugins: load theme on client side

This commit is contained in:
Chocobozzz 2019-07-10 14:06:19 +02:00 committed by Chocobozzz
parent 7cd4d2ba10
commit ffb321bedc
19 changed files with 194 additions and 91 deletions

View file

@ -92,6 +92,7 @@ export class ClientHtml {
let html = buffer.toString()
html = ClientHtml.addCustomCSS(html)
html = ClientHtml.addPluginCSS(html)
ClientHtml.htmlCache[ path ] = html
@ -138,11 +139,17 @@ export class ClientHtml {
}
private static addCustomCSS (htmlStringPage: string) {
const styleTag = '<style class="custom-css-style">' + CONFIG.INSTANCE.CUSTOMIZATIONS.CSS + '</style>'
const styleTag = `<style class="custom-css-style">${CONFIG.INSTANCE.CUSTOMIZATIONS.CSS}</style>`
return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.CUSTOM_CSS, styleTag)
}
private static addPluginCSS (htmlStringPage: string) {
const linkTag = `<link rel="stylesheet" href="/plugins/global.css" />`
return htmlStringPage.replace('</head>', linkTag + '</head>')
}
private static addVideoOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {
const previewUrl = WEBSERVER.URL + video.getPreviewStaticPath()
const videoUrl = WEBSERVER.URL + video.getWatchStaticPath()