mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 02:28:55 +00:00
parent
3e7cec2ecb
commit
4c581f9067
@ -48,6 +48,14 @@ if (appArgs.diskCacheSize) {
|
||||
app.commandLine.appendSwitch('disk-cache-size', appArgs.diskCacheSize);
|
||||
}
|
||||
|
||||
if (appArgs.basicAuthUsername) {
|
||||
app.commandLine.appendSwitch('basic-auth-username', appArgs.basicAuthUsername);
|
||||
}
|
||||
|
||||
if (appArgs.basicAuthPassword) {
|
||||
app.commandLine.appendSwitch('basic-auth-password', appArgs.basicAuthPassword);
|
||||
}
|
||||
|
||||
// do nothing for setDockBadge if not OSX
|
||||
let setDockBadge = () => {};
|
||||
|
||||
@ -100,7 +108,12 @@ app.on('ready', () => {
|
||||
app.on('login', (event, webContents, request, authInfo, callback) => {
|
||||
// for http authentication
|
||||
event.preventDefault();
|
||||
createLoginWindow(callback);
|
||||
|
||||
if (appArgs.basicAuthUsername !== null && appArgs.basicAuthPassword !== null) {
|
||||
callback(appArgs.basicAuthUsername, appArgs.basicAuthPassword);
|
||||
} else {
|
||||
createLoginWindow(callback);
|
||||
}
|
||||
});
|
||||
|
||||
if (appArgs.singleInstance) {
|
||||
|
10
docs/api.md
10
docs/api.md
@ -40,6 +40,8 @@
|
||||
- [[zoom]](#zoom)
|
||||
- [[crash-reporter]](#crash-reporter)
|
||||
- [[single-instance]](#single-instance)
|
||||
- [[basic-auth-username]](#basic-auth-username)
|
||||
- [[basic-auth-password]](#basic-auth-username)
|
||||
- [Programmatic API](#programmatic-api)
|
||||
|
||||
## Command Line
|
||||
@ -408,6 +410,14 @@ Sets a default zoom factor to be used when the app is opened, defaults to `1.0`.
|
||||
|
||||
Prevents application from being run multiple times. If such an attempt occurs the already running instance is brought to front.
|
||||
|
||||
#### [basic-auth-username]
|
||||
|
||||
```
|
||||
--basic-auth-username <value> --basic-auth-password <value>
|
||||
```
|
||||
|
||||
Set basic http(s) auth via the command line to have the app automatically log you in to a protected site. Both fields are required if one is set.
|
||||
|
||||
#### [processEnvs]
|
||||
|
||||
```
|
||||
|
@ -46,6 +46,8 @@ function selectAppArgs(options) {
|
||||
win32metadata: options.win32metadata,
|
||||
versionString: options.versionString,
|
||||
processEnvs: options.processEnvs,
|
||||
basicAuthUsername: options.basicAuthUsername,
|
||||
basicAuthPassword: options.basicAuthPassword,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,8 @@ if (require.main === module) {
|
||||
.option('--crash-reporter <value>', 'remote server URL to send crash reports')
|
||||
.option('--single-instance', 'allow only a single instance of the application')
|
||||
.option('--processEnvs <json-string>', 'a JSON string of key/value pairs to be set as environment variables before any browser windows are opened.', getProcessEnvs)
|
||||
.option('--basic-auth-username <value>', 'basic http(s) auth username')
|
||||
.option('--basic-auth-password <value>', 'basic http(s) auth password')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
|
@ -66,6 +66,8 @@ export default function (inpOptions) {
|
||||
FileDescription: inpOptions.name,
|
||||
},
|
||||
processEnvs: inpOptions.processEnvs,
|
||||
basicAuthUsername: inpOptions.basicAuthUsername || null,
|
||||
basicAuthPassword: inpOptions.basicAuthPassword || null,
|
||||
};
|
||||
|
||||
if (options.verbose) {
|
||||
|
Loading…
Reference in New Issue
Block a user