mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 13:51:13 +00:00
Fixing CSP for local dev
This commit is contained in:
parent
235a6f2abe
commit
7ebcb0563b
1 changed files with 9 additions and 1 deletions
|
@ -84,7 +84,15 @@ server.get('/*', async (req, res) => {
|
||||||
return res.redirect(context.url);
|
return res.redirect(context.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cspHtml = (
|
||||||
|
<meta
|
||||||
|
http-equiv="Content-Security-Policy"
|
||||||
|
content="default-src 'none'; connect-src 'self'; frame-src *; img-src *; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
const root = renderToString(wrapper);
|
const root = renderToString(wrapper);
|
||||||
|
const cspStr = process.env.LEMMY_EXTERNAL_HOST ? renderToString(cspHtml) : '';
|
||||||
const helmet = Helmet.renderStatic();
|
const helmet = Helmet.renderStatic();
|
||||||
|
|
||||||
res.send(`
|
res.send(`
|
||||||
|
@ -102,7 +110,7 @@ server.get('/*', async (req, res) => {
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<!-- Content Security Policy -->
|
<!-- Content Security Policy -->
|
||||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src 'self'; frame-src *; img-src *; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'">
|
${cspStr}
|
||||||
|
|
||||||
<!-- Web app manifest -->
|
<!-- Web app manifest -->
|
||||||
<link rel="manifest" href="/static/assets/manifest.webmanifest">
|
<link rel="manifest" href="/static/assets/manifest.webmanifest">
|
||||||
|
|
Loading…
Reference in a new issue