mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-02 03:48:23 +00:00
parent
28dca8c647
commit
cec9c4b819
@ -12,11 +12,12 @@ import inferFlash from './helpers/inferFlash';
|
||||
|
||||
const { isOSX } = helpers;
|
||||
|
||||
electronDownload();
|
||||
|
||||
const APP_ARGS_FILE_PATH = path.join(__dirname, '..', 'nativefier.json');
|
||||
const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
||||
|
||||
const fileDownloadOptions = Object.assign({}, appArgs.fileDownloadOptions);
|
||||
electronDownload(fileDownloadOptions);
|
||||
|
||||
if (appArgs.processEnvs) {
|
||||
Object.keys(appArgs.processEnvs).forEach((key) => {
|
||||
/* eslint-env node */
|
||||
|
17
docs/api.md
17
docs/api.md
@ -460,6 +460,20 @@ Example:
|
||||
nativefier <your-geolocation-enabled-website> --processEnvs '{"GOOGLE_API_KEY": "<your-google-api-key>"}'
|
||||
```
|
||||
|
||||
#### [file-download-options]
|
||||
|
||||
```
|
||||
--file-download-options <json-string>
|
||||
```
|
||||
|
||||
a JSON string of key/value pairs to be set as file download options. See [electron-dl](https://github.com/sindresorhus/electron-dl) for available options.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
nativefier <your-website> --file-download-options '{"saveAs": true}'
|
||||
```
|
||||
|
||||
## Programmatic API
|
||||
|
||||
You can use the Nativefier programmatic API as well.
|
||||
@ -498,6 +512,9 @@ var options = {
|
||||
honest: false,
|
||||
zoom: 1.0,
|
||||
singleInstance: false,
|
||||
fileDownloadOptions: {
|
||||
saveAs: true // always show "Save As" dialog
|
||||
},
|
||||
processEnvs: {
|
||||
"GOOGLE_API_KEY": "<your-google-api-key>"
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ function selectAppArgs(options) {
|
||||
win32metadata: options.win32metadata,
|
||||
versionString: options.versionString,
|
||||
processEnvs: options.processEnvs,
|
||||
fileDownloadOptions: options.fileDownloadOptions,
|
||||
tray: options.tray,
|
||||
basicAuthUsername: options.basicAuthUsername,
|
||||
basicAuthPassword: options.basicAuthPassword,
|
||||
|
@ -85,6 +85,7 @@ 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('--file-download-options <json-string>', 'a JSON string of key/value pairs to be set as file download options. See https://github.com/sindresorhus/electron-dl for available options.', parseJson)
|
||||
.option('--tray', 'allow app to stay in system tray')
|
||||
.option('--basic-auth-username <value>', 'basic http(s) auth username')
|
||||
.option('--basic-auth-password <value>', 'basic http(s) auth password')
|
||||
|
@ -66,6 +66,7 @@ export default function (inpOptions) {
|
||||
FileDescription: inpOptions.name,
|
||||
},
|
||||
processEnvs: inpOptions.processEnvs,
|
||||
fileDownloadOptions: inpOptions.fileDownloadOptions,
|
||||
tray: inpOptions.tray || false,
|
||||
basicAuthUsername: inpOptions.basicAuthUsername || null,
|
||||
basicAuthPassword: inpOptions.basicAuthPassword || null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user