2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-11 07:41:04 +00:00

Merge branch 'wiederkehr-feature/disable-web-security' into development

This commit is contained in:
Jia Hao 2016-02-23 21:09:25 +08:00
commit a6d9de4e01
5 changed files with 15 additions and 3 deletions

View File

@ -230,6 +230,13 @@ If this flag is passed, it will not override the user agent.
``` ```
Forces the packaged app to ignore certificate errors. Forces the packaged app to ignore certificate errors.
#### [disable-web-security]
```
--disable-web-security
```
Forces the packaged app to ignore web security errors.
## Programmatic API ## Programmatic API
You can use the Nativefier programmatic API as well. You can use the Nativefier programmatic API as well.
@ -260,6 +267,7 @@ var options = {
showMenuBar: false, showMenuBar: false,
userAgent: null, userAgent: null,
insecure: false, insecure: false,
disableWebSecurity: false,
honest: false honest: false
}; };

View File

@ -36,6 +36,7 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
plugins: true, plugins: true,
// node globals causes problems with sites like messenger.com // node globals causes problems with sites like messenger.com
nodeIntegration: false, nodeIntegration: false,
webSecurity: !options.disableWebSecurity,
preload: path.join(__dirname, 'static', 'preload.js') preload: path.join(__dirname, 'static', 'preload.js')
}, },
// after webpack path here should reference `resources/app/` // after webpack path here should reference `resources/app/`

View File

@ -39,7 +39,7 @@ function changeAppPackageJsonName(appPath, name) {
/** /**
* Only picks certain app args to pass to nativefier.json * Only picks certain app args to pass to nativefier.json
* @param options * @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) { function selectAppArgs(options) {
return { return {
@ -51,7 +51,8 @@ function selectAppArgs(options) {
showMenuBar: options.showMenuBar, showMenuBar: options.showMenuBar,
userAgent: options.userAgent, userAgent: options.userAgent,
nativefierVersion: options.nativefierVersion, nativefierVersion: options.nativefierVersion,
insecure: options.insecure insecure: options.insecure,
disableWebSecurity: options.disableWebSecurity
}; };
} }

View File

@ -29,6 +29,7 @@ if (require.main === module) {
.option('-u, --user-agent <value>', 'set the user agent string for the app') .option('-u, --user-agent <value>', '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('--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('--insecure', 'ignore certificate related errors')
.option('--disable-web-security', 'enable loading of insecure content, defaults to false')
.parse(process.argv); .parse(process.argv);
if (!process.argv.slice(2).length) { if (!process.argv.slice(2).length) {

View File

@ -46,7 +46,8 @@ function optionsFactory(inpOptions, callback) {
height: inpOptions.height || 800, height: inpOptions.height || 800,
showMenuBar: inpOptions.showMenuBar || false, showMenuBar: inpOptions.showMenuBar || false,
userAgent: inpOptions.userAgent || getFakeUserAgent(), userAgent: inpOptions.userAgent || getFakeUserAgent(),
insecure: inpOptions.insecure || false insecure: inpOptions.insecure || false,
disableWebSecurity: inpOptions.disableWebSecurity || false
}; };
if (inpOptions.honest) { if (inpOptions.honest) {