From 91c80526109e46331364b31b6b228ec6d35e72d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Gonz=C3=A1lez?= Date: Mon, 13 Feb 2023 13:02:50 +0000 Subject: [PATCH] [web] Use a specific manifest.json file for development To not change the content-security-policy in production. --- web/src/manifest.dev.json | 13 +++++++++++++ web/src/manifest.json | 3 +-- web/webpack.config.js | 5 ++++- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 web/src/manifest.dev.json diff --git a/web/src/manifest.dev.json b/web/src/manifest.dev.json new file mode 100644 index 0000000000..f6bea1abe9 --- /dev/null +++ b/web/src/manifest.dev.json @@ -0,0 +1,13 @@ +{ + "name": "d-installer", + "requires": { + "cockpit": "137" + }, + + "tools": { + "index": { + "label": "D-Installer" + } + }, + "content-security-policy": "connect-src 'self' https://localhost:9090 wss://localhost:9090 ws://localhost:8080" +} diff --git a/web/src/manifest.json b/web/src/manifest.json index f6bea1abe9..d31e0b37ed 100644 --- a/web/src/manifest.json +++ b/web/src/manifest.json @@ -8,6 +8,5 @@ "index": { "label": "D-Installer" } - }, - "content-security-policy": "connect-src 'self' https://localhost:9090 wss://localhost:9090 ws://localhost:8080" + } } diff --git a/web/webpack.config.js b/web/webpack.config.js index 63ccca8ba4..d50cba7c7d 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -29,7 +29,10 @@ const packageJson = JSON.parse(fs.readFileSync('package.json')); // Non-JS files which are copied verbatim to dist/ const copy_files = [ "./src/index.html", - "./src/manifest.json", + { + from: production ? "./src/manifest.json" : "./src/manifest.dev.json", + to: "manifest.json" + }, // TODO: consider using something more complete like https://github.com/jantimon/favicons-webpack-plugin "./src/assets/favicon.svg", ];