diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e17f54f..2a52ed57b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * Pass error message from spee.ch API during thumbnail upload ([#1840](https://github.com/lbryio/lbry-desktop/pull/1840)) * Use router pattern for rendering file viewer ([#1544](https://github.com/lbryio/lbry-desktop/pull/1544)) * Missing word "to" added to the Bid Help Text (#1854) + * Updated to electron@2 ([#1858](https://github.com/lbryio/lbry-desktop/pull/1858)) ### Fixed * **Wallet -> Get Credits** page now shows correct ShapeShift status when it's avialable ([#1836](https://github.com/lbryio/lbry-desktop/issues/1836)) 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..2f19fcd97 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'; @@ -58,6 +58,9 @@ if (isDev) { app.commandLine.appendSwitch('ignore-gpu-blacklist'); app.commandLine.appendSwitch('--disable-gpu-process-crash-limit'); app.disableDomainBlockingFor3DAPIs(); + + // Disable security warnings in dev mode - https://github.com/electron/electron/blob/master/docs/tutorial/security.md#electron-security-warnings + process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true; } app.on('ready', async () => { @@ -89,6 +92,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..4e3f7c24d 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.6: + 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"