diff --git a/commands/analyse.js b/commands/analyse.js index 05bf8b3..3d082c0 100644 --- a/commands/analyse.js +++ b/commands/analyse.js @@ -20,10 +20,11 @@ async function analyse_core(options) { throw ` url_input_file : "${URL_YAML_FILE}" is not a valid YAML file: ${error.code} at ${JSON.stringify(error.linePos)}.` } + let additionalArgs = String(options.chrome_flags).split(" "); let browserArgs = [ "--no-sandbox", // can't run inside docker without - "--disable-setuid-sandbox" // but security issues - ] + "--disable-setuid-sandbox", // but security issues + ].concat(additionalArgs); // Add proxy conf in browserArgs let proxy = {}; @@ -87,7 +88,7 @@ async function analyse_core(options) { else { await create_XLSX_report(reportObj, options); } - + } function readProxy(proxyFile) { @@ -136,4 +137,4 @@ function analyse(options) { analyse_core(options).catch(e=>console.error("ERROR : \n", e)) } -module.exports = analyse; \ No newline at end of file +module.exports = analyse; diff --git a/greenit b/greenit index 85cb6bc..fda1761 100644 --- a/greenit +++ b/greenit @@ -85,6 +85,11 @@ yargs(hideBin(process.argv)) description: 'Option to enable or disable web browser headless mode', default: true }) + .option('chrome_flags', { + type: 'array', + description: 'Additional Chrome flags. Example: --chrome-flags="--flag1 --flag2"', + default: [] + }) }, (argv) => { require("./commands/analyse.js")(argv) }) @@ -107,4 +112,4 @@ yargs(hideBin(process.argv)) .strict() .demandCommand() .help() - .argv \ No newline at end of file + .argv