mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 02:28:55 +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.
|
||||
|
||||
#### [insecure]
|
||||
|
||||
```
|
||||
--insecure
|
||||
```
|
||||
Forces the packaged app to ignore certificate errors.
|
||||
|
||||
## 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).
|
||||
|
@ -20,6 +20,10 @@ var appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
||||
|
||||
var mainWindow;
|
||||
|
||||
if (appArgs.insecure) {
|
||||
app.commandLine.appendSwitch('ignore-certificate-errors');
|
||||
}
|
||||
|
||||
// do nothing for setDockBadge if not OSX
|
||||
let setDockBadge = () => {};
|
||||
|
||||
|
@ -48,10 +48,11 @@ function buildApp(options, callback) {
|
||||
options.showMenuBar,
|
||||
options.userAgent,
|
||||
options.honest,
|
||||
options.insecure,
|
||||
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);
|
||||
});
|
||||
},
|
||||
@ -92,7 +93,7 @@ function buildApp(options, callback) {
|
||||
* @param {string} userAgent
|
||||
* @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;
|
||||
copy(srcAppDir, tempDir, function(error) {
|
||||
if (error) {
|
||||
@ -109,7 +110,8 @@ function copyPlaceholderApp(srcAppDir, tempDir, name, targetURL, counter, width,
|
||||
height: height,
|
||||
showMenuBar: showMenuBar,
|
||||
userAgent: userAgent,
|
||||
nativefierVersion: loadedPackageJson.version
|
||||
nativefierVersion: loadedPackageJson.version,
|
||||
insecure: insecure
|
||||
};
|
||||
|
||||
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('-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('--insecure', 'ignore certificate related errors')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
|
@ -25,6 +25,7 @@ function optionsFactory(name,
|
||||
showMenuBar = false,
|
||||
userAgent,
|
||||
honest = false,
|
||||
insecure = false,
|
||||
callback) {
|
||||
targetUrl = normalizeUrl(targetUrl);
|
||||
|
||||
@ -62,7 +63,8 @@ function optionsFactory(name,
|
||||
width: width,
|
||||
height: height,
|
||||
showMenuBar: showMenuBar,
|
||||
userAgent: userAgent
|
||||
userAgent: userAgent,
|
||||
insecure: insecure
|
||||
};
|
||||
|
||||
if (name && name.length > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user