update: upgrade electron to major version 9 with spectron to 11 and associated changes

This commit is contained in:
Xymorot 2020-07-25 22:30:00 +02:00
parent 0baba65686
commit f39c033a45
6 changed files with 836 additions and 438 deletions

1227
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@
"chai": "^4.2.0",
"chokidar": "^3.4.1",
"concurrently": "^5.2.0",
"electron": "^8.4.1",
"electron": "^9.1.1",
"electron-rebuild": "^1.11.0",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
@ -89,7 +89,7 @@
"prettier": "^2.0.5",
"rewiremock": "^3.14.3",
"sinon": "^9.0.2",
"spectron": "^10.0.1",
"spectron": "^11.1.0",
"svelte": "^3.24.0",
"svelte-loader": "^2.13.6",
"ts-loader": "^8.0.1",

View File

@ -15,11 +15,11 @@ export class Session implements ISession {
? [
'default-src devtools:;' +
"script-src 'unsafe-eval';" +
"script-src-elem devtools: 'sha256-hl04hLzKBpmsfWF2wIA/0Vs6ZNV5T9ZNFY//3uXrgSk=';" +
"script-src-elem file: devtools: 'sha256-hl04hLzKBpmsfWF2wIA/0Vs6ZNV5T9ZNFY//3uXrgSk=';" +
"style-src devtools: 'unsafe-inline';" +
'connect-src devtools: data:',
]
: ["default-src 'none'"],
: ["default-src 'self';" + "style-src 'unsafe-inline'"],
},
});
});

View File

@ -1,15 +0,0 @@
{
"prod": {
"csp": {
"default-src": ["self"],
"style-src": ["unsafe-inline"]
}
},
"dev": {
"csp": {
"default-src": ["self"],
"style-src": ["unsafe-inline"],
"script-src": ["self", "unsafe-eval"]
}
}
}

View File

@ -2,12 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
{{#if csp}}
<meta
http-equiv="Content-Security-Policy"
content="{{#each csp}}{{@key}}{{#each this}} '{{this}}'{{/each}};{{/each}}"
/>
{{/if}}
<title>{{appTitle}}</title>
</head>
<body id="app"></body>

View File

@ -3,22 +3,16 @@ const path = require('path');
const handlebars = require('handlebars');
const packageJson = require('../package');
function compile(isDevMode = false) {
const dataPath = path.resolve(__dirname, 'data.json');
const data = JSON.parse(fs.readFileSync(dataPath).toString());
function compile() {
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
const template = fs.readFileSync(templatePath).toString();
const delegate = handlebars.compile(template);
let extendedData;
if (isDevMode) {
extendedData = data.dev;
} else {
extendedData = data.prod;
}
extendedData.appBundle = './bundle.js';
extendedData.appTitle = packageJson.productName;
const data = {
appBundle: './bundle.js',
appTitle: packageJson.productName,
};
return delegate(extendedData);
return delegate(data);
}
exports.compile = compile;