Merge pull request #298 from feross/win

Add crash reporting
This commit is contained in:
Feross Aboukhadijeh
2016-04-04 23:52:28 -07:00
6 changed files with 38 additions and 16 deletions

View File

@@ -17,6 +17,8 @@ module.exports = {
AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update?version=' + APP_VERSION, AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update?version=' + APP_VERSION,
AUTO_UPDATE_CHECK_STARTUP_DELAY: 5 * 1000 /* 5 seconds */, AUTO_UPDATE_CHECK_STARTUP_DELAY: 5 * 1000 /* 5 seconds */,
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
CONFIG_PATH: applicationConfigPath(APP_NAME), CONFIG_PATH: applicationConfigPath(APP_NAME),
CONFIG_POSTER_PATH: path.join(applicationConfigPath(APP_NAME), 'Posters'), CONFIG_POSTER_PATH: path.join(applicationConfigPath(APP_NAME), 'Posters'),
CONFIG_TORRENT_PATH: path.join(applicationConfigPath(APP_NAME), 'Torrents'), CONFIG_TORRENT_PATH: path.join(applicationConfigPath(APP_NAME), 'Torrents'),

View File

@@ -30,14 +30,16 @@ function uninstall () {
} }
function installDarwin () { function installDarwin () {
var electron = require('electron') // TODO: Uncomment this once we upgrade past Electron 0.37.4.
var app = electron.app
// On OS X, only protocols that are listed in Info.plist can be set as the default // var electron = require('electron')
// handler at runtime. // var app = electron.app
app.setAsDefaultProtocolClient('magnet')
// 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 () {} function uninstallDarwin () {}

View File

@@ -1,6 +1,7 @@
var electron = require('electron') var electron = require('electron')
var app = electron.app var app = electron.app
var crashReporter = electron.crashReporter
var ipcMain = electron.ipcMain var ipcMain = electron.ipcMain
var autoUpdater = require('./auto-updater') var autoUpdater = require('./auto-updater')
@@ -130,10 +131,9 @@ function processArgv (argv) {
} }
function setupCrashReporter () { function setupCrashReporter () {
// require('crash-reporter').start({ crashReporter.start({
// productName: 'WebTorrent', companyName: config.APP_NAME,
// companyName: 'WebTorrent', productName: config.APP_NAME,
// submitURL: 'https://webtorrent.io/crash-report', submitURL: config.CRASH_REPORT_URL
// autoSubmit: true })
// })
} }

View File

@@ -40,13 +40,18 @@ function handleEvent (cmd) {
if (cmd === '--squirrel-uninstall') { if (cmd === '--squirrel-uninstall') {
// App was just uninstalled. Undo anything we did in the --squirrel-install and // App was just uninstalled. Undo anything we did in the --squirrel-install and
// --squirrel-updated handlers // --squirrel-updated handlers
removeShortcuts(function () {
app.quit()
})
// Uninstall .torrent file and magnet link handlers // Uninstall .torrent file and magnet link handlers
handlers.uninstall() 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 return true
} }

View File

@@ -21,7 +21,7 @@
"create-torrent": "^3.22.1", "create-torrent": "^3.22.1",
"drag-drop": "^2.11.0", "drag-drop": "^2.11.0",
"electron-localshortcut": "^0.6.0", "electron-localshortcut": "^0.6.0",
"electron-prebuilt": "0.37.4", "electron-prebuilt": "0.37.3",
"hyperx": "^2.0.2", "hyperx": "^2.0.2",
"main-loop": "^3.2.0", "main-loop": "^3.2.0",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",

View File

@@ -35,7 +35,9 @@ var Cast = null
// a renderer process (essentially a Chrome window). We're in the renderer process, // 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 // and this IPC channel receives from and sends messages to the main process
var ipcRenderer = electron.ipcRenderer var ipcRenderer = electron.ipcRenderer
var clipboard = electron.clipboard var clipboard = electron.clipboard
var crashReporter = electron.crashReporter
var dialog = remote.require('dialog') var dialog = remote.require('dialog')
// For easy debugging in Developer Tools // For easy debugging in Developer Tools
@@ -58,6 +60,9 @@ loadState(init)
* the dock icon and drag+drop. * the dock icon and drag+drop.
*/ */
function init () { function init () {
setupCrashReporter()
// Push the first page into the location history
state.location.go({ url: 'home' }) state.location.go({ url: 'home' })
// Lazily load the WebTorrent, Chromecast, and Airplay modules // Lazily load the WebTorrent, Chromecast, and Airplay modules
@@ -1057,3 +1062,11 @@ function playInterfaceSound (name) {
audio.src = sound.url audio.src = sound.url
audio.play() audio.play()
} }
function setupCrashReporter () {
crashReporter.start({
companyName: config.APP_NAME,
productName: config.APP_NAME,
submitURL: config.CRASH_REPORT_URL
})
}