mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-04-01 12:31:51 +00:00
Add command line flag to make the packaged app ignore certificate errors, fixes #69
This commit is contained in:
parent
78a624c23f
commit
d74c368627
@ -185,6 +185,13 @@ By default, nativefier uses a preset user agent string for your OS and masquerad
|
|||||||
|
|
||||||
If this flag is passed, it will not override the user agent.
|
If this flag is passed, it will not override the user agent.
|
||||||
|
|
||||||
|
#### [insecure]
|
||||||
|
|
||||||
|
```
|
||||||
|
--insecure
|
||||||
|
```
|
||||||
|
Forces the packaged app to ignore certificate errors.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
A template app with the appropriate event listeners and callbacks set up is included in the `./app` folder. When the `nativefier` command is executed, this folder is copied to a temporary directory with the appropriate parameters in a configuration file, and is packaged into an app with [Electron Packager](https://github.com/maxogden/electron-packager).
|
A template app with the appropriate event listeners and callbacks set up is included in the `./app` folder. When the `nativefier` command is executed, this folder is copied to a temporary directory with the appropriate parameters in a configuration file, and is packaged into an app with [Electron Packager](https://github.com/maxogden/electron-packager).
|
||||||
|
@ -20,6 +20,10 @@ var appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
|||||||
|
|
||||||
var mainWindow;
|
var mainWindow;
|
||||||
|
|
||||||
|
if (appArgs.insecure) {
|
||||||
|
app.commandLine.appendSwitch('ignore-certificate-errors');
|
||||||
|
}
|
||||||
|
|
||||||
// do nothing for setDockBadge if not OSX
|
// do nothing for setDockBadge if not OSX
|
||||||
let setDockBadge = () => {};
|
let setDockBadge = () => {};
|
||||||
|
|
||||||
|
@ -48,10 +48,11 @@ function buildApp(options, callback) {
|
|||||||
options.showMenuBar,
|
options.showMenuBar,
|
||||||
options.userAgent,
|
options.userAgent,
|
||||||
options.honest,
|
options.honest,
|
||||||
|
options.insecure,
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
(options, callback) => {
|
(options, callback) => {
|
||||||
copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.counter, options.width, options.height, options.showMenuBar, options.userAgent, (error, tempDirPath) => {
|
copyPlaceholderApp(options.dir, tmpPath, options.name, options.targetUrl, options.counter, options.width, options.height, options.showMenuBar, options.userAgent, options.insecure, (error, tempDirPath) => {
|
||||||
callback(error, tempDirPath, options);
|
callback(error, tempDirPath, options);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -92,7 +93,7 @@ function buildApp(options, callback) {
|
|||||||
* @param {string} userAgent
|
* @param {string} userAgent
|
||||||
* @param {tempDirCallback} callback
|
* @param {tempDirCallback} callback
|
||||||
*/
|
*/
|
||||||
function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, counter, width, height, showMenuBar, userAgent, callback) {
|
function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, counter, width, height, showMenuBar, userAgent, insecure, callback) {
|
||||||
const loadedPackageJson = packageJson;
|
const loadedPackageJson = packageJson;
|
||||||
copy(srcAppDir, tempDir, function(error) {
|
copy(srcAppDir, tempDir, function(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -109,7 +110,8 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, counter, width,
|
|||||||
height: height,
|
height: height,
|
||||||
showMenuBar: showMenuBar,
|
showMenuBar: showMenuBar,
|
||||||
userAgent: userAgent,
|
userAgent: userAgent,
|
||||||
nativefierVersion: loadedPackageJson.version
|
nativefierVersion: loadedPackageJson.version,
|
||||||
|
insecure: insecure
|
||||||
};
|
};
|
||||||
|
|
||||||
fs.writeFileSync(path.join(tempDir, '/nativefier.json'), JSON.stringify(appArgs));
|
fs.writeFileSync(path.join(tempDir, '/nativefier.json'), JSON.stringify(appArgs));
|
||||||
|
@ -28,6 +28,7 @@ if (require.main === module) {
|
|||||||
.option('-m, --show-menu-bar', 'set menu bar visible, defaults to false')
|
.option('-m, --show-menu-bar', 'set menu bar visible, defaults to false')
|
||||||
.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')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
if (!process.argv.slice(2).length) {
|
if (!process.argv.slice(2).length) {
|
||||||
|
@ -25,6 +25,7 @@ function optionsFactory(name,
|
|||||||
showMenuBar = false,
|
showMenuBar = false,
|
||||||
userAgent,
|
userAgent,
|
||||||
honest = false,
|
honest = false,
|
||||||
|
insecure = false,
|
||||||
callback) {
|
callback) {
|
||||||
targetUrl = normalizeUrl(targetUrl);
|
targetUrl = normalizeUrl(targetUrl);
|
||||||
|
|
||||||
@ -62,7 +63,8 @@ function optionsFactory(name,
|
|||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
showMenuBar: showMenuBar,
|
showMenuBar: showMenuBar,
|
||||||
userAgent: userAgent
|
userAgent: userAgent,
|
||||||
|
insecure: insecure
|
||||||
};
|
};
|
||||||
|
|
||||||
if (name && name.length > 0) {
|
if (name && name.length > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user