Allow unsafe eval in dev mode only

This commit is contained in:
Dima Gerasimov 2019-12-09 21:58:36 +00:00
parent 50f08ac3b5
commit 8b6069db43
3 changed files with 7 additions and 4 deletions

2
build
View file

@ -33,8 +33,6 @@ def main():
*args, *args,
], **kwargs) ], **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 {} maybe_release = {'NODE_ENV': 'production'} if args.release else {}
env = { env = {
'TARGET': target, 'TARGET': target,

View file

@ -1,5 +1,4 @@
{ {
"short_name": "grasp",
"icons": { "icons": {
"128": "unicorn.png" "128": "unicorn.png"
}, },

View file

@ -12,7 +12,9 @@ const pkg = require('./package.json');
const baseManifest = require('./src/manifest.json'); const baseManifest = require('./src/manifest.json');
const target = env.TARGET; 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 // TODO make permissions literate
const permissions = [ const permissions = [
@ -56,6 +58,10 @@ const manifestExtra = {
commands: commandsExtra, commands: commandsExtra,
}; };
if (dev) {
manifestExtra.content_security_policy = "script-src 'self' 'unsafe-eval'; object-src 'self'";
}
if (target === 'chrome') { if (target === 'chrome') {
manifestExtra.options_ui = {chrome_style: true}; manifestExtra.options_ui = {chrome_style: true};
} }