0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

Add script sanitization to template.js

This commit is contained in:
G.Ambatte
2024-05-05 20:18:53 +12:00
parent eb0440d36d
commit ffa90c397c

View File

@@ -8,6 +8,8 @@ const template = async function(name, title='', props = {}){
});
const ogMetaTags = ogTags.join('\n');
const cleanProps = JSON.stringify(props).replace(/<\/script/g, '<\\\/script');
return `<!DOCTYPE html>
<html>
<head>
@@ -23,7 +25,7 @@ const template = async function(name, title='', props = {}){
<body>
<main id="reactRoot">${require(`../build/${name}/ssr.js`)(props)}</main>
<script src=${`/${name}/bundle.js`}></script>
<script>start_app(${JSON.stringify(props)})</script>
<script>start_app(${cleanProps})</script>
</body>
</html>
`;