From ab435ee5a68fbd148d18dffce1546c8bf8c7c389 Mon Sep 17 00:00:00 2001 From: romo-dw Date: Wed, 5 Jul 2017 15:07:31 +0200 Subject: [PATCH] Add support for --disk-cache-size Electron flag (PR #400) --- app/src/main.js | 4 ++++ docs/api.md | 8 ++++++++ src/build/buildApp.js | 1 + src/cli.js | 1 + src/options/optionsMain.js | 1 + 5 files changed, 15 insertions(+) diff --git a/app/src/main.js b/app/src/main.js index 1189069..8d43d58 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -29,6 +29,10 @@ if (appArgs.ignoreCertificate) { app.commandLine.appendSwitch('ignore-certificate-errors'); } +if (appArgs.diskCacheSize) { + app.commandLine.appendSwitch('disk-cache-size', appArgs.diskCacheSize); +} + // do nothing for setDockBadge if not OSX let setDockBadge = () => {}; diff --git a/docs/api.md b/docs/api.md index 678033f..e42ed51 100644 --- a/docs/api.md +++ b/docs/api.md @@ -29,6 +29,7 @@ - [[insecure]](#insecure) - [[flash]](#flash) - [[flash-path]](#flash-path) + - [[disk-cache-size]](#disk-cache-size) - [[inject]](#inject) - [[full-screen]](#full-screen) - [[maximize]](#maximize) @@ -266,6 +267,13 @@ Take note that if this flag is specified, the `--insecure` flag will be added au You can also specify the path to the Chrome flash plugin directly with this flag. The path can be found at [chrome://plugins](chrome://plugins), under `Adobe Flash Player` > `Location`. This flag automatically enables the `--flash` flag as well. +#### [disk-cache-size] + +``` +--disk-cache-size +``` +Forces the maximum disk space to be used by the disk cache. Value is given in bytes. + #### [inject] ``` diff --git a/src/build/buildApp.js b/src/build/buildApp.js index d82da8a..362014e 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -28,6 +28,7 @@ function selectAppArgs(options) { ignoreCertificate: options.ignoreCertificate, insecure: options.insecure, flashPluginDir: options.flashPluginDir, + diskCacheSize: options.diskCacheSize, fullScreen: options.fullScreen, hideWindowFrame: options.hideWindowFrame, maximize: options.maximize, diff --git a/src/cli.js b/src/cli.js index a45b074..80c3bcd 100755 --- a/src/cli.js +++ b/src/cli.js @@ -41,6 +41,7 @@ if (require.main === module) { .option('--insecure', 'enable loading of insecure content, defaults to false') .option('--flash', 'if flash should be enabled') .option('--flash-path ', 'path to Chrome flash plugin, find it in `Chrome://plugins`') + .option('--disk-cache-size ', 'forces the maximum disk space (in bytes) to be used by the disk cache') .option('--inject ', 'path to a CSS/JS file to be injected', collect, []) .option('--full-screen', 'if the app should always be started in full screen') .option('--maximize', 'if the app should always be started maximized') diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index 8aa9aaf..3a7b8c8 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -44,6 +44,7 @@ export default function (inpOptions) { ignoreCertificate: inpOptions.ignoreCertificate || false, insecure: inpOptions.insecure || false, flashPluginDir: inpOptions.flashPath || inpOptions.flash || null, + diskCacheSize: inpOptions.diskCacheSize || null, inject: inpOptions.inject || null, ignore: 'src', fullScreen: inpOptions.fullScreen || false,