From: Sander Saarend <sander@saarend.com> Date: Wed, 12 Jul 2023 14:03:49 +0000 (+0300) Subject: Fix CSP in dev mode (#1918) X-Git-Url: http://these/git/%22https:/image.com/%7B%7D/%24%7Bargs.pageFn.prev%7D?a=commitdiff_plain;h=5d4edf555e4014ee5a4d384230e87ed06a1aa8fa;p=lemmy-ui.git Fix CSP in dev mode (#1918) --- diff --git a/package.json b/package.json index 5e3535b..fdc1dfd 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "analyze": "webpack --mode=none", "prebuild:dev": "yarn clean && node generate_translations.js", - "build:dev": "webpack --env LEMMY_UI_DISABLE_CSP=true --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development", + "build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development", "prebuild:prod": "yarn clean && node generate_translations.js", "build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production", "clean": "yarn run rimraf dist", diff --git a/src/server/index.tsx b/src/server/index.tsx index 458d7f0..3b9352b 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -29,7 +29,11 @@ server.use( ); server.use(setCacheControl); -if (!process.env["LEMMY_UI_DISABLE_CSP"] && !process.env["LEMMY_UI_DEBUG"]) { +if ( + !process.env["LEMMY_UI_DISABLE_CSP"] && + !process.env["LEMMY_UI_DEBUG"] && + process.env["NODE_ENV"] !== "development" +) { server.use(setDefaultCsp); }