From c422151ef83f3ed00edeb7222e8791ab9531fa8f Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 4 Apr 2016 20:55:19 -0700 Subject: [PATCH 1/5] HACK: add setTimeout to uninstaller --- main/squirrel-win32.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/squirrel-win32.js b/main/squirrel-win32.js index 7ae1c781..6c5b7bbc 100644 --- a/main/squirrel-win32.js +++ b/main/squirrel-win32.js @@ -40,13 +40,18 @@ function handleEvent (cmd) { if (cmd === '--squirrel-uninstall') { // App was just uninstalled. Undo anything we did in the --squirrel-install and // --squirrel-updated handlers - removeShortcuts(function () { - app.quit() - }) // Uninstall .torrent file and magnet link handlers handlers.uninstall() + // Remove desktop/start menu shortcuts. + // HACK: add a callback to handlers.uninstall() so we can remove this setTimeout + setTimeout(function () { + removeShortcuts(function () { + app.quit() + }) + }, 1000) + return true } From 7c38f374f3210839a0ff06072ea5df381957f48d Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 4 Apr 2016 23:10:47 -0700 Subject: [PATCH 2/5] Setup crash reporter --- main/index.js | 12 ++++++------ renderer/index.js | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/main/index.js b/main/index.js index bbc81a1b..977cfd7c 100644 --- a/main/index.js +++ b/main/index.js @@ -1,6 +1,7 @@ var electron = require('electron') var app = electron.app +var crashReporter = electron.crashReporter var ipcMain = electron.ipcMain var autoUpdater = require('./auto-updater') @@ -130,10 +131,9 @@ function processArgv (argv) { } function setupCrashReporter () { - // require('crash-reporter').start({ - // productName: 'WebTorrent', - // companyName: 'WebTorrent', - // submitURL: 'https://webtorrent.io/crash-report', - // autoSubmit: true - // }) + crashReporter.start({ + companyName: config.APP_NAME, + productName: config.APP_NAME, + submitURL: 'https://webtorrent.io/desktop/crash-report' + }) } diff --git a/renderer/index.js b/renderer/index.js index 4fbedb30..fae215e8 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -35,7 +35,9 @@ var Cast = null // a renderer process (essentially a Chrome window). We're in the renderer process, // and this IPC channel receives from and sends messages to the main process var ipcRenderer = electron.ipcRenderer + var clipboard = electron.clipboard +var crashReporter = electron.crashReporter var dialog = remote.require('dialog') // For easy debugging in Developer Tools @@ -58,6 +60,9 @@ loadState(init) * the dock icon and drag+drop. */ function init () { + setupCrashReporter() + + // Push the first page into the location history state.location.go({ url: 'home' }) // Lazily load the WebTorrent, Chromecast, and Airplay modules @@ -1057,3 +1062,11 @@ function playInterfaceSound (name) { audio.src = sound.url audio.play() } + +function setupCrashReporter () { + crashReporter.start({ + companyName: config.APP_NAME, + productName: config.APP_NAME, + submitURL: 'https://webtorrent.io/desktop/crash-report' + }) +} From 22421e365caf7fd1bdd64143fc3ddbe8d327a3c3 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 4 Apr 2016 23:12:11 -0700 Subject: [PATCH 3/5] Revert "chore(package): update electron-prebuilt to version 0.37.4" This reverts commit 509e2804e00476f15065ab84b18e3d55b6e05fad. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 857ca4e7..6c37fad6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "create-torrent": "^3.22.1", "drag-drop": "^2.11.0", "electron-localshortcut": "^0.6.0", - "electron-prebuilt": "0.37.4", + "electron-prebuilt": "0.37.3", "hyperx": "^2.0.2", "main-loop": "^3.2.0", "mkdirp": "^0.5.1", From 997aa7c9225e492d5df35bad30111019b2180a44 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 4 Apr 2016 23:27:12 -0700 Subject: [PATCH 4/5] TEMPORARY: Comment out code that requires Electron 0.37.4 --- main/handlers.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main/handlers.js b/main/handlers.js index 50b9a082..b174609f 100644 --- a/main/handlers.js +++ b/main/handlers.js @@ -30,14 +30,16 @@ function uninstall () { } function installDarwin () { - var electron = require('electron') - var app = electron.app + // TODO: Uncomment this once we upgrade past Electron 0.37.4. - // On OS X, only protocols that are listed in Info.plist can be set as the default - // handler at runtime. - app.setAsDefaultProtocolClient('magnet') + // var electron = require('electron') + // var app = electron.app - // File handlers are registered in the Info.plist. + // // On OS X, only protocols that are listed in Info.plist can be set as the default + // // handler at runtime. + // app.setAsDefaultProtocolClient('magnet') + + // // File handlers are registered in the Info.plist. } function uninstallDarwin () {} From 76487326f109b6fdf74bba48185f06223eb10efd Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 4 Apr 2016 23:27:26 -0700 Subject: [PATCH 5/5] Move crash report URL to config.js --- config.js | 2 ++ main/index.js | 2 +- renderer/index.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 158ccb3f..a5edb5c4 100644 --- a/config.js +++ b/config.js @@ -17,6 +17,8 @@ module.exports = { AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update?version=' + APP_VERSION, AUTO_UPDATE_CHECK_STARTUP_DELAY: 5 * 1000 /* 5 seconds */, + CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report', + CONFIG_PATH: applicationConfigPath(APP_NAME), CONFIG_POSTER_PATH: path.join(applicationConfigPath(APP_NAME), 'Posters'), CONFIG_TORRENT_PATH: path.join(applicationConfigPath(APP_NAME), 'Torrents'), diff --git a/main/index.js b/main/index.js index 977cfd7c..82374204 100644 --- a/main/index.js +++ b/main/index.js @@ -134,6 +134,6 @@ function setupCrashReporter () { crashReporter.start({ companyName: config.APP_NAME, productName: config.APP_NAME, - submitURL: 'https://webtorrent.io/desktop/crash-report' + submitURL: config.CRASH_REPORT_URL }) } diff --git a/renderer/index.js b/renderer/index.js index fae215e8..b22ee1d6 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -1067,6 +1067,6 @@ function setupCrashReporter () { crashReporter.start({ companyName: config.APP_NAME, productName: config.APP_NAME, - submitURL: 'https://webtorrent.io/desktop/crash-report' + submitURL: config.CRASH_REPORT_URL }) }