electron-194: adds support to set chrome flags

This commit is contained in:
Vishwas Shashidhar
2017-10-26 16:53:15 +05:30
parent 0fd57a8dd0
commit 6f28edc5bb
3 changed files with 61 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ const AutoLaunch = require('auto-launch');
const urlParser = require('url');
// Local Dependencies
const {getConfigField, updateUserConfigWin, updateUserConfigMac} = require('./config.js');
const {getConfigField, updateUserConfigWin, updateUserConfigMac, readConfigFileSync} = require('./config.js');
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
@@ -87,6 +87,31 @@ if (isMac) {
});
}
function setChromeFlags() {
log.send(logLevels.INFO, 'checking if we need to set custom chrome flags!');
let config = readConfigFileSync();
if (config && config !== null && config.customFlags) {
log.send(logLevels.INFO, 'Chrome flags config found!');
if (config.customFlags.authServerWhitelist && config.customFlags.authServerWhitelist !== "") {
log.send(logLevels.INFO, 'Setting auth server whitelist flag');
app.commandLine.appendSwitch('auth-server-whitelist', config.customFlags.authServerWhitelist);
}
if (config.customFlags.authNegotiateDelegateWhitelist && config.customFlags.authNegotiateDelegateWhitelist !== "") {
log.send(logLevels.INFO, 'Setting auth negotiate delegate whitelist flag');
app.commandLine.appendSwitch('auth-negotiate-delegate-whitelist', config.customFlags.authNegotiateDelegateWhitelist);
}
}
}
setChromeFlags();
/**
* This method will be called when Electron has finished
* initialization and is ready to create browser windows.