From f63f2e9e2bb66888af394538bae54ecdbee214fc Mon Sep 17 00:00:00 2001 From: Goh Jia Hao Date: Sun, 9 Oct 2016 13:52:50 +0800 Subject: [PATCH] Merge branch 'master' into development - Pull request was accidentally merged into master --- app/src/main.js | 12 +++++++++++- docs/api.md | 15 +++++++++++++++ src/build/buildApp.js | 3 ++- src/cli.js | 1 + src/options/optionsMain.js | 1 + 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/src/main.js b/app/src/main.js index bda3cfa..dfc903f 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -1,7 +1,7 @@ import 'source-map-support/register'; import fs from 'fs'; import path from 'path'; -import {app, ipcMain} from 'electron'; +import {app, ipcMain, crashReporter} from 'electron'; import createLoginWindow from './components/login/loginWindow'; import createMainWindow from './components/mainWindow/mainWindow'; import helpers from './helpers/helpers'; @@ -62,6 +62,16 @@ app.on('before-quit', () => { } }); +if (appArgs.crashReporter) { + app.on('will-finish-launching', () => { + crashReporter.start({ + productName: appArgs.name, + submitURL: appArgs.crashReporter, + autoSubmit: true + }); + }); +} + app.on('ready', () => { mainWindow = createMainWindow(appArgs, app.quit, setDockBadge); }); diff --git a/docs/api.md b/docs/api.md index a7d6c5a..0c14209 100644 --- a/docs/api.md +++ b/docs/api.md @@ -36,6 +36,7 @@ - [[disable-context-menu]](#disable-context-menu) - [[disable-dev-tools]](#disable-dev-tools) - [[zoom]](#zoom) + - [[crash-reporter]](#crash-reporter) - [Programmatic API](#programmatic-api) ## Command Line @@ -328,6 +329,20 @@ Disable the context menu Disable the Chrome developer tools +#### [crash-reporter] + +``` +--crash-reporter +``` + +Enables crash reporting and set the URL to submit crash reports to + +Example: + +```bash +$ nativefier http://google.com --crash-reporter https://electron-crash-reporter.appspot.com/PROJECT_ID/create/ +``` + #### [zoom] ``` diff --git a/src/build/buildApp.js b/src/build/buildApp.js index 6fd0dd7..57860ab 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -116,7 +116,8 @@ function selectAppArgs(options) { disableContextMenu: options.disableContextMenu, disableDevTools: options.disableDevTools, zoom: options.zoom, - internalUrls: options.internalUrls + internalUrls: options.internalUrls, + crashReporter: options.crashReporter }; } diff --git a/src/cli.js b/src/cli.js index 8e3cc77..82ed3b1 100755 --- a/src/cli.js +++ b/src/cli.js @@ -52,6 +52,7 @@ if (require.main === module) { .option('--disable-dev-tools', 'disable developer tools') .option('--zoom ', 'default zoom factor to use when the app is opened, defaults to 1.0', parseFloat) .option('--internal-urls ', 'regular expression of URLs to consider "internal"; all other URLs will be opened in an external browser. (default: URLs on same second-level domain as app)') + .option('--crash-reporter ', 'remote server URL to send crash reports') .parse(process.argv); if (!process.argv.slice(2).length) { diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index d0132c8..65f00e5 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -64,6 +64,7 @@ function optionsFactory(inpOptions, callback) { verbose: inpOptions.verbose, disableContextMenu: inpOptions.disableContextMenu, disableDevTools: inpOptions.disableDevTools, + crashReporter: inpOptions.crashReporter, // workaround for electron-packager#375 tmpdir: false, zoom: inpOptions.zoom || 1.0,