mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
Electron 385: add support for custom tlds (#347)
- add logic setting ntlm on default session - add logic to include custom tlds - fix failing tests
This commit is contained in:
parent
ab978399ff
commit
9a11bf90e1
@ -5,6 +5,7 @@
|
||||
"alwaysOnTop" : false,
|
||||
"bringToFront": false,
|
||||
"whitelistUrl": "*",
|
||||
"customTlds": [],
|
||||
"isCustomTitleBar": true,
|
||||
"memoryRefresh": true,
|
||||
"notificationSettings": {
|
||||
|
@ -3,6 +3,23 @@
|
||||
const { getGlobalConfigField } = require('./../config.js');
|
||||
const parseDomain = require('parse-domain');
|
||||
const isEqual = require('lodash.isequal');
|
||||
const log = require('../log.js');
|
||||
const logLevels = require('../enums/logLevels.js');
|
||||
|
||||
let customTlds = [];
|
||||
|
||||
getGlobalConfigField('customTlds')
|
||||
.then((domains) => {
|
||||
|
||||
if (domains && Array.isArray(domains) && domains.length > 0) {
|
||||
log.send(logLevels.INFO, `setting custom tlds that are -> ${domains}`);
|
||||
customTlds = domains;
|
||||
}
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
log.send(logLevels.INFO, `error setting custom tlds -> ${err}`);
|
||||
});
|
||||
|
||||
/**
|
||||
* Loops through the list of whitelist urls
|
||||
@ -35,7 +52,7 @@ function isWhitelisted(url) {
|
||||
*/
|
||||
function checkWhitelist(url, whitelist) {
|
||||
let whitelistArray = whitelist.split(',');
|
||||
const parsedUrl = parseDomain(url);
|
||||
const parsedUrl = parseDomain(url, {customTlds});
|
||||
|
||||
if (!parsedUrl) {
|
||||
return false;
|
||||
|
@ -3,6 +3,7 @@
|
||||
const fs = require('fs');
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const electronSession = electron.session;
|
||||
const globalShortcut = electron.globalShortcut;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const path = require('path');
|
||||
@ -19,7 +20,7 @@ const logLevels = require('./enums/logLevels.js');
|
||||
const notify = require('./notify/electron-notify.js');
|
||||
const eventEmitter = require('./eventEmitter');
|
||||
const throttle = require('./utils/throttle.js');
|
||||
const { getConfigField, updateConfigField, getGlobalConfigField } = require('./config.js');
|
||||
const { getConfigField, updateConfigField, getGlobalConfigField, readConfigFileSync } = require('./config.js');
|
||||
const { isMac, isNodeEnv, isWindows10, isWindowsOS } = require('./utils/misc');
|
||||
const { deleteIndexFolder } = require('./search/search.js');
|
||||
const { isWhitelisted } = require('./utils/whitelistHandler');
|
||||
@ -121,6 +122,19 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
||||
|
||||
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
||||
|
||||
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 ntlm domains');
|
||||
electronSession.defaultSession.allowNTLMCredentialsForDomains(config.customFlags.authServerWhitelist);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let newWinOpts = {
|
||||
title: 'Symphony',
|
||||
show: true,
|
||||
|
Loading…
Reference in New Issue
Block a user