From 5f5b13d7feafbeefddb484065bb286f391c872f6 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 15 Jul 2020 19:42:08 -0700 Subject: [PATCH 1/3] update to electron 10.0.0-beta.11 --- package-lock.json | 72 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index de819b2e..e7204c9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -308,17 +308,20 @@ } }, "@electron/get": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.5.0.tgz", - "integrity": "sha512-tafxBz6n08G6SX961F/h8XFtpB/DdwRvJJoDeOH9x78jDSCMQ2G/rRWqSwLFp9oeMFBJf0Pf5Kkw6TKt5w9TWg==", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.12.2.tgz", + "integrity": "sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==", "dev": true, "requires": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", + "global-agent": "^2.0.2", + "global-tunnel-ng": "^2.7.1", "got": "^9.6.0", + "progress": "^2.0.3", "sanitize-filename": "^1.6.2", - "sumchecker": "^3.0.0" + "sumchecker": "^3.0.1" }, "dependencies": { "debug": { @@ -330,12 +333,6 @@ "ms": "^2.1.1" } }, - "env-paths": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz", - "integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA==", - "dev": true - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -346,15 +343,6 @@ "jsonfile": "^4.0.0", "universalify": "^0.1.0" } - }, - "sumchecker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.0.tgz", - "integrity": "sha512-yreseuC/z4iaodVoq07XULEOO9p4jnQazO7mbrnDSvWAU/y2cbyIKs+gWJptfcGu9R+1l27K8Rkj0bfvqnBpgQ==", - "dev": true, - "requires": { - "debug": "^4.1.0" - } } } }, @@ -2786,9 +2774,9 @@ "dev": true }, "electron": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-9.1.0.tgz", - "integrity": "sha512-VRAF8KX1m0py9I9sf0kw1kWfeC87mlscfFcbcRdLBsNJ44/GrJhi3+E8rKbpHUeZNQxsPaVA5Zu5Lxb6dV/scQ==", + "version": "10.0.0-beta.11", + "resolved": "https://registry.npmjs.org/electron/-/electron-10.0.0-beta.11.tgz", + "integrity": "sha512-2310EB2H9mjlRCHY/Zdd7TuItnF0wqs171vSp/0oluh+VHJZVc+MaecMayGpHiyCBnIqmzVB0f9YUB5r0xmJGQ==", "dev": true, "requires": { "@electron/get": "^1.0.1", @@ -3985,15 +3973,26 @@ } }, "extract-zip": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", - "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", + "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", "dev": true, "requires": { - "concat-stream": "1.6.2", - "debug": "2.6.9", - "mkdirp": "0.5.1", - "yauzl": "2.4.1" + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } } }, "extsprintf": { @@ -4042,9 +4041,9 @@ } }, "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "dev": true, "requires": { "pend": "~1.2.0" @@ -10898,12 +10897,13 @@ } }, "yauzl": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", - "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "dev": true, "requires": { - "fd-slicer": "~1.0.1" + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" } }, "zip-stream": { diff --git a/package.json b/package.json index 422237a0..794641a6 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "buble": "^0.20.0", "cross-zip": "^3.1.0", "depcheck": "^1.0.0", - "electron": "~9.1.0", + "electron": "^10.0.0-beta.11", "electron-osx-sign": "^0.4.17", "electron-packager": "^15.0.0", "electron-winstaller": "^4.0.1", From 57a003d7c59913ecf007245709a407df1c4f6418 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 15 Jul 2020 19:44:34 -0700 Subject: [PATCH 2/3] electron 10 crash reporter changes Crash reporter doesn't need to be started in child processes, and in fact the functions are all deprecated. Instead start it from the main process, and the child processes will automatically be covered Change of params to crashReporter.start() function --- src/crash-reporter.js | 5 +++-- src/main/index.js | 9 ++++----- src/renderer/main.js | 3 --- src/renderer/webtorrent.js | 4 ---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/crash-reporter.js b/src/crash-reporter.js index 8fd2ac15..baa806ac 100644 --- a/src/crash-reporter.js +++ b/src/crash-reporter.js @@ -7,8 +7,9 @@ function init () { const electron = require('electron') electron.crashReporter.start({ - companyName: config.APP_NAME, productName: config.APP_NAME, - submitURL: config.CRASH_REPORT_URL + submitURL: config.CRASH_REPORT_URL, + globalExtra: { _companyName: config.APP_NAME }, + compress: true }) } diff --git a/src/main/index.js b/src/main/index.js index d670caba..e2fb125b 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -3,10 +3,13 @@ console.time('init') const electron = require('electron') const app = electron.app +// Start crash reporter early, so it takes effect for child processes +const crashReporter = require('../crash-reporter') +crashReporter.init() + const parallel = require('run-parallel') const config = require('../config') -const crashReporter = require('../crash-reporter') const ipc = require('./ipc') const log = require('./log') const menu = require('./menu') @@ -109,10 +112,6 @@ function init () { ipc.init() - app.once('will-finish-launching', function () { - crashReporter.init() - }) - app.once('ipcReady', function () { log('Command line args:', argv) processArgv(argv) diff --git a/src/renderer/main.js b/src/renderer/main.js index 7592dc0d..3ceecdc8 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -14,9 +14,6 @@ Module.prototype.require = function (id) { console.time('init') -const crashReporter = require('../crash-reporter') -crashReporter.init() - // Perf optimization: Start asynchronously read on config file before all the // blocking require() calls below. diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index f61d4776..46630858 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -12,14 +12,10 @@ const networkAddress = require('network-address') const path = require('path') const WebTorrent = require('webtorrent') -const crashReporter = require('../crash-reporter') const config = require('../config') const { TorrentKeyNotFoundError } = require('./lib/errors') const torrentPoster = require('./lib/torrent-poster') -// Report when the process crashes -crashReporter.init() - // Send & receive messages from the main window const ipc = electron.ipcRenderer From 48ad571a59bc8ee292b7f66d7fd24df940dab95c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 15 Jul 2020 19:45:59 -0700 Subject: [PATCH 3/3] electron 10: re-enable remote module Electron 10 disables the remote module by default. We've always tried to avoid using `remote` in WTD so there aren't many occurrances of it, but there are still a few places where we use it --- package.json | 2 +- src/main/windows/about.js | 3 ++- src/main/windows/main.js | 3 ++- src/main/windows/webtorrent.js | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 794641a6..1073b870 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "buble": "^0.20.0", "cross-zip": "^3.1.0", "depcheck": "^1.0.0", - "electron": "^10.0.0-beta.11", + "electron": "~10.0.0-beta.11", "electron-osx-sign": "^0.4.17", "electron-packager": "^15.0.0", "electron-winstaller": "^4.0.1", diff --git a/src/main/windows/about.js b/src/main/windows/about.js index 52c3a1c3..3e0e3e6b 100644 --- a/src/main/windows/about.js +++ b/src/main/windows/about.js @@ -26,7 +26,8 @@ function init () { useContentSize: true, webPreferences: { nodeIntegration: true, - enableBlinkFeatures: 'AudioVideoTracks' + enableBlinkFeatures: 'AudioVideoTracks', + enableRemoteModule: true }, width: 300 }) diff --git a/src/main/windows/main.js b/src/main/windows/main.js index 10967bff..2bff63b4 100644 --- a/src/main/windows/main.js +++ b/src/main/windows/main.js @@ -44,7 +44,8 @@ function init (state, options) { width: initialBounds.width, webPreferences: { nodeIntegration: true, - enableBlinkFeatures: 'AudioVideoTracks' + enableBlinkFeatures: 'AudioVideoTracks', + enableRemoteModule: true }, x: initialBounds.x, y: initialBounds.y diff --git a/src/main/windows/webtorrent.js b/src/main/windows/webtorrent.js index dfb723f7..a0828a61 100644 --- a/src/main/windows/webtorrent.js +++ b/src/main/windows/webtorrent.js @@ -26,7 +26,8 @@ function init () { useContentSize: true, webPreferences: { nodeIntegration: true, - enableBlinkFeatures: 'AudioVideoTracks' + enableBlinkFeatures: 'AudioVideoTracks', + enableRemoteModule: true }, width: 150 })