]> Untitled Git - lemmy-ui.git/commitdiff
Fix CSP in dev mode (#1918)
authorSander Saarend <sander@saarend.com>
Wed, 12 Jul 2023 14:03:49 +0000 (17:03 +0300)
committerGitHub <noreply@github.com>
Wed, 12 Jul 2023 14:03:49 +0000 (10:03 -0400)
package.json
src/server/index.tsx

index 5e3535b9049a745b482dd4b0c6c57295c9f91a81..fdc1dfdaf1522b49f5422ed87a471420187cc34e 100644 (file)
@@ -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",
index 458d7f03e388aee6ccdc07edad21f99ad9a31d61..3b9352bfb7f4c3acfecbb406a602c061cec945d6 100644 (file)
@@ -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);
 }