From 404bab30c3853c6822799c2e670ef98af38e1c30 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Sat, 26 Mar 2016 15:06:50 +0800 Subject: [PATCH] No longer enable flash by default Flash should be enabled with `--flash`, which will also enable the `--insecure` flag --- README.md | 2 +- app/src/main.js | 4 ++-- docs/api.md | 17 +++++++++++++---- src/cli.js | 3 ++- src/options/optionsMain.js | 6 +++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a97894b..e38a008 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ View the changelog [here](docs/changelog.md). ### Features - Automatically retrieves the correct icon and app name -- Flash Support (Needs Testing) +- Flash Support (with [`--flash`](docs/api.md#flash) flag) - Javascript and CSS injection ## Installation diff --git a/app/src/main.js b/app/src/main.js index 48673b4..433227e 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -15,9 +15,9 @@ const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8')); let mainWindow; -if (appArgs.flashPluginDir) { +if (typeof appArgs.flashPluginDir === 'string') { app.commandLine.appendSwitch('ppapi-flash-path', appArgs.flashPluginDir); -} else { +} else if (appArgs.flashPluginDir) { const flashPath = inferFlash(); app.commandLine.appendSwitch('ppapi-flash-path', flashPath); } diff --git a/docs/api.md b/docs/api.md index b7359a6..e9f2b5d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -23,6 +23,7 @@ - [[ignore-certificate]](#ignore-certificate) - [[insecure]](#insecure) - [[flash]](#flash) + - [[flash-path]](#flash-path) - [[inject]](#inject) - [[full-screen]](#full-screen) - [[maximize]](#maximize) @@ -194,17 +195,25 @@ Forces the packaged app to ignore certificate errors. ``` --insecure ``` -Forces the packaged app to ignore web security errors. +Forces the packaged app to ignore web security errors, such as [Mixed Content](https://developer.mozilla.org/en-US/docs/Security/Mixed_content) errors when receiving HTTP content on a HTTPS site. #### [flash] ``` ---flash +--flash ``` -By default, Nativefier will automatically try to determine the location of your Google Chrome flash binary. In the event that Flash does not appear to work, you can specify it directly with this command line flag, by retrieving the location of the Flash path from [chrome://plugins](chrome://plugins), under `Adobe Flash Player` > `Location`. +If `--flash` is specified, Nativefier will automatically try to determine the location of your Google Chrome flash binary. Take note that the version of Chrome on your computer should be the same as the version used by the version of Electron for the Nativefied package. -From my experience, it might be helpful to pass the `--insecure` flag if you are using nativefied flash apps, as some `https` websites tend to serve flash insecurely. +Take note that if this flag is specified, the `--insecure` flag will be added automatically, to prevent the Mixed Content errors on sites such as [Twitch.tv](https://www.twitch.tv/). + +#### [flash-path] + +``` +--flash-path +``` + +You can also specify the path to the Chrome flash plugin directly with this flag. The path can be found at [chrome://plugins](chrome://plugins), under `Adobe Flash Player` > `Location`. This flag automatically enables the `--flash` flag as well. #### [inject] diff --git a/src/cli.js b/src/cli.js index f773357..c795d4f 100755 --- a/src/cli.js +++ b/src/cli.js @@ -36,7 +36,8 @@ if (require.main === module) { .option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser') .option('--ignore-certificate', 'ignore certificate related errors') .option('--insecure', 'enable loading of insecure content, defaults to false') - .option('--flash ', 'path to Chrome flash plugin, find it in `Chrome://plugins`') + .option('--flash', 'if flash should be enabled') + .option('--flash-path ', 'path to Chrome flash plugin, find it in `Chrome://plugins`') .option('--inject ', 'path to a file to be injected', collect, []) .option('--full-screen', 'if the app should always be started in full screen') .option('--maximize', 'if the app should always be started maximized') diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index e192a6a..df0f603 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -50,7 +50,7 @@ function optionsFactory(inpOptions, callback) { userAgent: inpOptions.userAgent, ignoreCertificate: inpOptions.ignoreCertificate || false, insecure: inpOptions.insecure || false, - flashPluginDir: inpOptions.flash || null, + flashPluginDir: inpOptions.flashPath || inpOptions.flash || null, inject: inpOptions.inject || null, ignore: 'src', fullScreen: inpOptions.fullScreen || false, @@ -64,6 +64,10 @@ function optionsFactory(inpOptions, callback) { log.setLevel('error'); } + if (options.flashPluginDir) { + options.insecure = true; + } + if (inpOptions.honest) { options.userAgent = null; }