1
0
Fork 0

Fix config injection with custom HTML/CSS

This commit is contained in:
Chocobozzz 2021-09-09 09:13:45 +02:00
parent c504295581
commit b4c945f3c7
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -382,8 +382,9 @@ class ClientHtml {
} }
private static addServerConfig (htmlStringPage: string, serverConfig: HTMLServerConfig) { private static addServerConfig (htmlStringPage: string, serverConfig: HTMLServerConfig) {
const serverConfigString = JSON.stringify(serverConfig) // Stringify the JSON object, and then stringify the string object so we can inject it into the HTML
const configScriptTag = `<script type="application/javascript">window.PeerTubeServerConfig = '${serverConfigString}'</script>` const serverConfigString = JSON.stringify(JSON.stringify(serverConfig))
const configScriptTag = `<script type="application/javascript">window.PeerTubeServerConfig = ${serverConfigString}</script>`
return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.SERVER_CONFIG, configScriptTag) return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.SERVER_CONFIG, configScriptTag)
} }