From 5e8d8e8710f7c81f2f945b8d0770caf2a8e5c845 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Mon, 6 Aug 2018 12:14:58 -0400 Subject: [PATCH 1/3] chore: update electron Also includes fix from https://github.com/electron/electron/issues/13008#issuecomment-400261941 --- package.json | 2 +- src/main/index.js | 11 ++++++++++- yarn.lock | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) 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" From 364782023f300701b1bfa4f8381aa169f602a91b Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Wed, 8 Aug 2018 12:53:33 -0400 Subject: [PATCH 2/3] disable dev mode security warnings + yarn lock update for 2.0.6 (it was already the version resolved previously) --- src/main/index.js | 3 +++ yarn.lock | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index 94ea0d7b0..2f19fcd97 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -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 () => { diff --git a/yarn.lock b/yarn.lock index 038e9453f..4e3f7c24d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3173,7 +3173,7 @@ electron-window-state@^4.1.1: jsonfile "^2.2.3" mkdirp "^0.5.1" -electron@^2.0.5: +electron@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/electron/-/electron-2.0.6.tgz#8e5c1bd2ebc08fa7a6ee906de3753c1ece9d7300" dependencies: From d15585e6cc75983e80f6db07f53fa11ccede4bcf Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 8 Aug 2018 17:10:20 -0400 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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))