diff options
author | Chocobozzz <me@florianbigard.com> | 2021-09-09 09:13:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-09-09 09:13:45 +0200 |
commit | b4c945f3c727d1ce5de5a4af69d6dfa14c83468e (patch) | |
tree | 9bb60bdc721a41fda74e9042ccf4a558ecb7a42f /server | |
parent | c504295581a820a4c26ae524d288f20dcad5b5b2 (diff) | |
download | PeerTube-b4c945f3c727d1ce5de5a4af69d6dfa14c83468e.tar.gz PeerTube-b4c945f3c727d1ce5de5a4af69d6dfa14c83468e.tar.zst PeerTube-b4c945f3c727d1ce5de5a4af69d6dfa14c83468e.zip |
Fix config injection with custom HTML/CSS
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/client-html.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 3b0a68f4d..3529acf5e 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -382,8 +382,9 @@ class ClientHtml { | |||
382 | } | 382 | } |
383 | 383 | ||
384 | private static addServerConfig (htmlStringPage: string, serverConfig: HTMLServerConfig) { | 384 | private static addServerConfig (htmlStringPage: string, serverConfig: HTMLServerConfig) { |
385 | const serverConfigString = JSON.stringify(serverConfig) | 385 | // Stringify the JSON object, and then stringify the string object so we can inject it into the HTML |
386 | const configScriptTag = `<script type="application/javascript">window.PeerTubeServerConfig = '${serverConfigString}'</script>` | 386 | const serverConfigString = JSON.stringify(JSON.stringify(serverConfig)) |
387 | const configScriptTag = `<script type="application/javascript">window.PeerTubeServerConfig = ${serverConfigString}</script>` | ||
387 | 388 | ||
388 | return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.SERVER_CONFIG, configScriptTag) | 389 | return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.SERVER_CONFIG, configScriptTag) |
389 | } | 390 | } |