diff --git a/server/controllers/view.js b/server/controllers/view.js index 5c4bb84e29d..2ac8b8e3973 100644 --- a/server/controllers/view.js +++ b/server/controllers/view.js @@ -55,15 +55,17 @@ const renderIndex = async (ctx, params) => { extStyles, hostname: ctx.hostname, importMap: JSON.stringify(importMap), - globals: JSON.stringify({ - config: clientConfig, - manifest, - localeManifest, - theme, - defaultTheme, - useDefaultTheme, - ...params, - }), + globals: encodeURIComponent( + JSON.stringify({ + config: clientConfig, + manifest, + localeManifest, + theme, + defaultTheme, + useDefaultTheme, + ...params, + }), + ) }); }; @@ -82,16 +84,18 @@ const renderV3Index = async (ctx, params) => { isDev: global.MODE_DEV, title: clientConfig.title, hostname: ctx.hostname, - globals: JSON.stringify({ - config: clientConfig, - localeManifest, + globals: encodeURIComponent( + JSON.stringify({ + config: clientConfig, + localeManifest, - theme, - defaultTheme, - useDefaultTheme, + theme, + defaultTheme, + useDefaultTheme, - ...params, - }), + ...params, + }), + ) }); }; @@ -164,17 +168,19 @@ const renderTerminal = async ctx => { favicon, hostname: ctx.hostname, importMap: JSON.stringify(importMap), - globals: JSON.stringify({ - config: clientConfig, - manifest, - localeManifest, - user, - ksConfig, - runtime, - theme, - defaultTheme, - useDefaultTheme, - }), + globals: encodeURIComponent( + JSON.stringify({ + config: clientConfig, + manifest, + localeManifest, + user, + ksConfig, + runtime, + theme, + defaultTheme, + useDefaultTheme, + }), + ) }); } catch (err) { await renderViewErr(ctx, err); diff --git a/server/views/consolev3.html b/server/views/consolev3.html index 3c80ecc6f9a..c272aa5f87a 100644 --- a/server/views/consolev3.html +++ b/server/views/consolev3.html @@ -18,7 +18,7 @@
<% if (manifest && manifest.js && manifest.js.length > 0) { %> <% manifest.js.forEach(function(item){ %> diff --git a/server/views/index.html b/server/views/index.html index 29a255ef6d7..b7bc0d1ac85 100644 --- a/server/views/index.html +++ b/server/views/index.html @@ -26,7 +26,7 @@ { "imports": <%- importMap %> } <% if (isDev) { %> <%- include('./components/dev_scripts.html') %> <% } else { %> <%- include('./components/prod_scripts.html') %> <% } %> diff --git a/server/views/terminal.html b/server/views/terminal.html index 3e2c0bd2e94..ed944eb14ab 100644 --- a/server/views/terminal.html +++ b/server/views/terminal.html @@ -23,7 +23,7 @@ { "imports": <%- importMap %> } <% if (isDev) { %>