diff --git a/README.md b/README.md index ded7b72..1cf2cec 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,13 @@ If this flag is passed, it will not override the user agent. ``` Forces the packaged app to ignore certificate errors. +#### [disable-web-security] + +``` +--disable-web-security +``` +Forces the packaged app to ignore web security errors. + #### [flash] ``` @@ -273,6 +280,7 @@ var options = { showMenuBar: false, userAgent: null, insecure: false, + disableWebSecurity: false, honest: false }; diff --git a/app/src/components/mainWindow/mainWindow.js b/app/src/components/mainWindow/mainWindow.js index 5119118..1f19214 100644 --- a/app/src/components/mainWindow/mainWindow.js +++ b/app/src/components/mainWindow/mainWindow.js @@ -36,6 +36,7 @@ function createMainWindow(options, onAppQuit, setDockBadge) { plugins: true, // node globals causes problems with sites like messenger.com nodeIntegration: false, + webSecurity: !options.disableWebSecurity, preload: path.join(__dirname, 'static', 'preload.js') }, // after webpack path here should reference `resources/app/` diff --git a/src/build/buildApp.js b/src/build/buildApp.js index 1e108cf..9782c2f 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -39,7 +39,7 @@ function changeAppPackageJsonName(appPath, name) { /** * Only picks certain app args to pass to nativefier.json * @param options - * @returns {{name: (*|string), targetUrl: (string|*), counter: *, width: *, height: *, showMenuBar: *, userAgent: *, nativefierVersion: *, insecure: *}} + * @returns {{name: (*|string), targetUrl: (string|*), counter: *, width: *, height: *, showMenuBar: *, userAgent: *, nativefierVersion: *, insecure: *, disableWebSecurity: *}} */ function selectAppArgs(options) { return { @@ -52,6 +52,7 @@ function selectAppArgs(options) { userAgent: options.userAgent, nativefierVersion: options.nativefierVersion, insecure: options.insecure, + disableWebSecurity: options.disableWebSecurity, flashPluginDir: options.flashPluginDir }; } diff --git a/src/cli.js b/src/cli.js index 2ef31ee..a482dd4 100755 --- a/src/cli.js +++ b/src/cli.js @@ -29,6 +29,7 @@ if (require.main === module) { .option('-u, --user-agent ', 'set the user agent string for the app') .option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser') .option('--insecure', 'ignore certificate related errors') + .option('--disable-web-security', 'enable loading of insecure content, defaults to false') .option('--flash ', 'path to Chrome flash plugin, find it in `Chrome://plugins`') .parse(process.argv); diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index 2282e88..838bb5b 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -35,7 +35,7 @@ function optionsFactory(inpOptions, callback) { targetUrl: normalizeUrl(inpOptions.targetUrl), platform: inpOptions.platform || inferPlatform(), arch: inpOptions.arch || inferArch(), - version: ELECTRON_VERSION, + version: inpOptions.electronVersion || ELECTRON_VERSION, nativefierVersion: packageJson.version, out: inpOptions.out || process.cwd(), overwrite: inpOptions.overwrite || false, @@ -47,6 +47,7 @@ function optionsFactory(inpOptions, callback) { showMenuBar: inpOptions.showMenuBar || false, userAgent: inpOptions.userAgent || getFakeUserAgent(), insecure: inpOptions.insecure || false, + disableWebSecurity: inpOptions.disableWebSecurity || false, flashPluginDir: inpOptions.flash || null }; @@ -70,6 +71,7 @@ function optionsFactory(inpOptions, callback) { }); }, callback => { + // length also checks if its the commanderJS function or a string if (options.name && options.name.length > 0) { callback(); return;