From 8b6069db439e5c6bc58fb32b62b3a3c42f51f6b4 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Mon, 9 Dec 2019 21:58:36 +0000 Subject: [PATCH] Allow unsafe eval in dev mode only --- build | 2 -- src/manifest.json | 1 - webpack.config.js | 8 +++++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build b/build index e15d0d2..4f4e0de 100755 --- a/build +++ b/build @@ -33,8 +33,6 @@ def main(): *args, ], **kwargs) - # TODO do I need that back for dev manifest?? - # "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'" maybe_release = {'NODE_ENV': 'production'} if args.release else {} env = { 'TARGET': target, diff --git a/src/manifest.json b/src/manifest.json index f3e20d6..e01685d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,5 +1,4 @@ { - "short_name": "grasp", "icons": { "128": "unicorn.png" }, diff --git a/webpack.config.js b/webpack.config.js index c3f7b08..37cd30b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,7 +12,9 @@ const pkg = require('./package.json'); const baseManifest = require('./src/manifest.json'); const target = env.TARGET; -const pkg_name = env.ANY_HOST ? "grasp (any host)" : "grasp"; +const dev = env.NODE_ENV === "development"; + +const pkg_name = (env.ANY_HOST ? "grasp (any host)" : "grasp") + (dev ? ' [dev]' : ''); // TODO make permissions literate const permissions = [ @@ -56,6 +58,10 @@ const manifestExtra = { commands: commandsExtra, }; +if (dev) { + manifestExtra.content_security_policy = "script-src 'self' 'unsafe-eval'; object-src 'self'"; +} + if (target === 'chrome') { manifestExtra.options_ui = {chrome_style: true}; }