diff --git a/package.json b/package.json index 37043ce21..fa5d5a862 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "decompress": "^4.2.0", "del": "^3.0.0", "devtron": "^1.4.0", - "electron": "^1.8.4", + "electron": "^2.0.6", "electron-builder": "^20.22.0", "electron-devtools-installer": "^2.2.3", "electron-webpack": "^1.13.0", diff --git a/src/main/index.js b/src/main/index.js index 1c81d6217..94ea0d7b0 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -5,7 +5,7 @@ import SemVer from 'semver'; import findProcess from 'find-process'; import url from 'url'; import https from 'https'; -import { shell, app, ipcMain, dialog } from 'electron'; +import { shell, app, ipcMain, dialog, session } from 'electron'; import { autoUpdater } from 'electron-updater'; import isDev from 'electron-is-dev'; import Daemon from './Daemon'; @@ -89,6 +89,15 @@ app.on('ready', async () => { rendererWindow.webContents.send('devtools-is-opened'); }); tray = createTray(rendererWindow); + // HACK: patch webrequest to fix devtools incompatibility with electron 2.x. + // See https://github.com/electron/electron/issues/13008#issuecomment-400261941 + session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => { + if (details.url.indexOf('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33') !== -1) { + callback({redirectURL: details.url.replace('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33', '57c9d07b416b5a2ea23d28247300e4af36329bdc')}); + } else { + callback({cancel: false}); + } + }); }); app.on('activate', () => { diff --git a/yarn.lock b/yarn.lock index 34412fae2..038e9453f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3173,9 +3173,9 @@ electron-window-state@^4.1.1: jsonfile "^2.2.3" mkdirp "^0.5.1" -electron@^1.8.4: - version "1.8.7" - resolved "https://registry.yarnpkg.com/electron/-/electron-1.8.7.tgz#373c1dc4589d7ab4acd49aff8db4a1c0a6c3bcc1" +electron@^2.0.5: + version "2.0.6" + resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.6.tgz#8e5c1bd2ebc08fa7a6ee906de3753c1ece9d7300" dependencies: "@types/node" "^8.0.24" electron-download "^3.0.1"