update: upgrade electron to major version 8 and spectron to major version 10
This commit is contained in:
parent
5496fef4bc
commit
080d71f1e8
|
@ -3387,28 +3387,20 @@
|
|||
"dev": true
|
||||
},
|
||||
"electron": {
|
||||
"version": "6.1.9",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-6.1.9.tgz",
|
||||
"integrity": "sha512-Sm6pIR9yr9oBnIzwWnwSyTiZwj3fdp3X0pBDWDmw2wf/RtZlKH4PEkEu622AZLyXyhBKUiD2Jajkr5c4MelRxw==",
|
||||
"version": "8.0.3",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-8.0.3.tgz",
|
||||
"integrity": "sha512-lr/tTr9cBzocREmL8r/P3WKnGqpKeaMFZjNVXDGd3npxwnJVUd7SHQW7LZIhZ1W2XoU3uBwTYbyH43iCIElsqw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "^10.12.18",
|
||||
"electron-download": "^4.1.0",
|
||||
"@electron/get": "^1.0.1",
|
||||
"@types/node": "^12.0.12",
|
||||
"extract-zip": "^1.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "10.17.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.17.tgz",
|
||||
"integrity": "sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"electron-chromedriver": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-6.0.0.tgz",
|
||||
"integrity": "sha512-UIhRl0sN5flfUjqActXsFrZQU1NmBObvlxzPnyeud8vhR67TllXCoqfvhQJmIrJAJJK+5M1DFhJ5iTGT++dvkg==",
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-8.0.0.tgz",
|
||||
"integrity": "sha512-d0210ExhkGOwYLXFZHQR6LISZ8UbMqXWLwjTe8Cdh44XlO4z4+6DWQfM0p7aB2Qak/An6tN732Yl98wN1ylZww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"electron-download": "^4.1.1",
|
||||
|
@ -5183,13 +5175,13 @@
|
|||
}
|
||||
},
|
||||
"globule": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz",
|
||||
"integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==",
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
|
||||
"integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "~7.1.1",
|
||||
"lodash": "~4.17.10",
|
||||
"lodash": "~4.17.12",
|
||||
"minimatch": "~3.0.2"
|
||||
}
|
||||
},
|
||||
|
@ -8950,9 +8942,9 @@
|
|||
}
|
||||
},
|
||||
"rgb2hex": {
|
||||
"version": "0.1.9",
|
||||
"resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.9.tgz",
|
||||
"integrity": "sha512-32iuQzhOjyT+cv9aAFRBJ19JgHwzQwbjUhH3Fj2sWW2EEGAW8fpFrDFP5ndoKDxJaLO06x1hE3kyuIFrUQtybQ==",
|
||||
"version": "0.1.10",
|
||||
"resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.10.tgz",
|
||||
"integrity": "sha512-vKz+kzolWbL3rke/xeTE2+6vHmZnNxGyDnaVW4OckntAIcc7DcZzWkQSfxMDwqHS8vhgySnIFyBUH7lIk6PxvQ==",
|
||||
"dev": true
|
||||
},
|
||||
"rimraf": {
|
||||
|
@ -8998,9 +8990,9 @@
|
|||
}
|
||||
},
|
||||
"run-async": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
|
||||
"integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.0.tgz",
|
||||
"integrity": "sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-promise": "^2.1.0"
|
||||
|
@ -9543,13 +9535,14 @@
|
|||
"dev": true
|
||||
},
|
||||
"spectron": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/spectron/-/spectron-8.0.0.tgz",
|
||||
"integrity": "sha512-MI9+lAamDnw7S0vKaxXjU3g5qaW5KANaFLc+Hgq+QmMCkQbZLt6ukFFGfalmwIuYrmq+yWQPCD4CXgt3VSHrLA==",
|
||||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/spectron/-/spectron-10.0.1.tgz",
|
||||
"integrity": "sha512-eMAOr7ovYf+e6+DhkoxVWAMRfZvLJMjtZKwWYkL56fv3Ij6rxhYLjOxybKj0phgMYZ7o2cX5zu2NoyiUM756CA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/webdriverio": "^4.8.0",
|
||||
"dev-null": "^0.1.1",
|
||||
"electron-chromedriver": "^6.0.0",
|
||||
"electron-chromedriver": "^8.0.0",
|
||||
"request": "^2.87.0",
|
||||
"split": "^1.0.0",
|
||||
"webdriverio": "^4.13.0"
|
||||
|
|
|
@ -64,14 +64,13 @@
|
|||
"@types/node-fetch": "^2.5.5",
|
||||
"@types/sinon": "^7.5.2",
|
||||
"@types/uuid": "^7.0.0",
|
||||
"@types/webdriverio": "^4.13.3",
|
||||
"@types/webpack": "^4.41.7",
|
||||
"@typescript-eslint/eslint-plugin": "^2.22.0",
|
||||
"@typescript-eslint/parser": "^2.22.0",
|
||||
"chai": "^4.2.0",
|
||||
"chokidar": "^3.3.1",
|
||||
"concurrently": "^5.1.0",
|
||||
"electron": "^6.1.9",
|
||||
"electron": "^8.0.3",
|
||||
"electron-rebuild": "^1.10.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
|
@ -86,7 +85,7 @@
|
|||
"prettier": "^1.19.1",
|
||||
"rewiremock": "^3.13.9",
|
||||
"sinon": "^9.0.0",
|
||||
"spectron": "^8.0.0",
|
||||
"spectron": "^10.0.1",
|
||||
"svelte": "^3.19.1",
|
||||
"svelte-loader": "^2.13.6",
|
||||
"ts-loader": "^6.2.1",
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
import { session } from 'electron';
|
||||
import { isDev } from '../../core/dev';
|
||||
import { ISession } from './i-session';
|
||||
import { injectable } from 'inversify';
|
||||
import OnHeadersReceivedDetails = Electron.OnHeadersReceivedDetails;
|
||||
import OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
|
||||
|
||||
@injectable()
|
||||
export class Session implements ISession {
|
||||
public setHeaders(): void {
|
||||
// these headers only work on web requests, file:// protocol is handled via meta tags in the html
|
||||
session.defaultSession.webRequest.onHeadersReceived(
|
||||
(details: OnHeadersReceivedDetails, callback: (response: {}) => void) => {
|
||||
(details: OnHeadersReceivedListenerDetails, callback: (response: {}) => void) => {
|
||||
callback({
|
||||
responseHeaders: {
|
||||
...details.responseHeaders,
|
||||
'Content-Security-Policy': ["default-src 'none'"],
|
||||
'Content-Security-Policy': isDev()
|
||||
? [
|
||||
'default-src devtools:;' +
|
||||
"script-src 'unsafe-eval';" +
|
||||
"script-src-elem devtools: 'sha256-hl04hLzKBpmsfWF2wIA/0Vs6ZNV5T9ZNFY//3uXrgSk=';" +
|
||||
"style-src devtools: 'unsafe-inline';" +
|
||||
'connect-src devtools: data:',
|
||||
]
|
||||
: ["default-src 'none'"],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue