mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge branch 'electron-194' into electron-205
This commit is contained in:
commit
afbb37ea95
@ -11,5 +11,9 @@
|
||||
"submitURL": "https://localhost:1127/post",
|
||||
"companyName": "Symphony",
|
||||
"uploadToServer": false
|
||||
},
|
||||
"customFlags": {
|
||||
"authServerWhitelist": "",
|
||||
"authNegotiateDelegateWhitelist": ""
|
||||
}
|
||||
}
|
32
js/config.js
32
js/config.js
@ -382,6 +382,34 @@ function clearCachedConfigs() {
|
||||
globalConfig = null;
|
||||
}
|
||||
|
||||
function readConfigFileSync() {
|
||||
|
||||
let configPath;
|
||||
let globalConfigFileName = path.join('config', configFileName);
|
||||
if (isDevEnv) {
|
||||
// for dev env, get config file from asar
|
||||
configPath = path.join(app.getAppPath(), globalConfigFileName);
|
||||
} else {
|
||||
// for non-dev, config file is placed by installer relative to exe.
|
||||
// this is so the config can be easily be changed post install.
|
||||
let execPath = path.dirname(app.getPath('exe'));
|
||||
// for mac exec is stored in subdir, for linux/windows config
|
||||
// dir is in the same location.
|
||||
configPath = path.join(execPath, isMac ? '..' : '', globalConfigFileName);
|
||||
}
|
||||
|
||||
let data = fs.readFileSync(configPath);
|
||||
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
} catch (err) {
|
||||
console.log("parsing config failed", err);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
configFileName,
|
||||
@ -395,6 +423,8 @@ module.exports = {
|
||||
|
||||
// items below here are only exported for testing, do NOT use!
|
||||
saveUserConfig,
|
||||
clearCachedConfigs
|
||||
clearCachedConfigs,
|
||||
|
||||
readConfigFileSync
|
||||
|
||||
};
|
||||
|
37
js/main.js
37
js/main.js
@ -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 {setCheckboxValues} = require('./menus/menuTemplate.js');
|
||||
const { isMac, isDevEnv } = require('./utils/misc.js');
|
||||
const protocolHandler = require('./protocolHandler');
|
||||
@ -90,6 +90,39 @@ if (isMac) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets chrome authentication flags in electron
|
||||
*/
|
||||
function setChromeFlags() {
|
||||
|
||||
log.send(logLevels.INFO, 'checking if we need to set custom chrome flags!');
|
||||
|
||||
// Read the config parameters synchronously
|
||||
let config = readConfigFileSync();
|
||||
|
||||
// If we cannot find any config, just skip setting any flags
|
||||
if (config && config !== null && config.customFlags) {
|
||||
|
||||
log.send(logLevels.INFO, 'Chrome flags config found!');
|
||||
|
||||
// If we cannot find the authServerWhitelist config, move on
|
||||
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 we cannot find the authNegotiateDelegateWhitelist config, move on
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Set the chrome flags
|
||||
setChromeFlags();
|
||||
|
||||
/**
|
||||
* This method will be called when Electron has finished
|
||||
* initialization and is ready to create browser windows.
|
||||
@ -160,7 +193,7 @@ function setupThenOpenMainWindow() {
|
||||
let customDataArg = getCmdLineArg(process.argv, '--userDataPath=', false);
|
||||
|
||||
if (customDataArg && customDataArg.split('=').length > 1) {
|
||||
let customDataFolder = customDataArg.split('=')[1];
|
||||
let customDataFolder = customDataArg.split('=')[1];
|
||||
app.setPath('userData', customDataFolder);
|
||||
}
|
||||
if (!isMac && hasInstallFlag) {
|
||||
|
Loading…
Reference in New Issue
Block a user