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,
|
"alwaysOnTop" : false,
|
||||||
"bringToFront": false,
|
"bringToFront": false,
|
||||||
"whitelistUrl": "*",
|
"whitelistUrl": "*",
|
||||||
|
"customTlds": [],
|
||||||
"isCustomTitleBar": true,
|
"isCustomTitleBar": true,
|
||||||
"memoryRefresh": true,
|
"memoryRefresh": true,
|
||||||
"notificationSettings": {
|
"notificationSettings": {
|
||||||
|
@ -3,6 +3,23 @@
|
|||||||
const { getGlobalConfigField } = require('./../config.js');
|
const { getGlobalConfigField } = require('./../config.js');
|
||||||
const parseDomain = require('parse-domain');
|
const parseDomain = require('parse-domain');
|
||||||
const isEqual = require('lodash.isequal');
|
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
|
* Loops through the list of whitelist urls
|
||||||
@ -35,7 +52,7 @@ function isWhitelisted(url) {
|
|||||||
*/
|
*/
|
||||||
function checkWhitelist(url, whitelist) {
|
function checkWhitelist(url, whitelist) {
|
||||||
let whitelistArray = whitelist.split(',');
|
let whitelistArray = whitelist.split(',');
|
||||||
const parsedUrl = parseDomain(url);
|
const parsedUrl = parseDomain(url, {customTlds});
|
||||||
|
|
||||||
if (!parsedUrl) {
|
if (!parsedUrl) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
|
const electronSession = electron.session;
|
||||||
const globalShortcut = electron.globalShortcut;
|
const globalShortcut = electron.globalShortcut;
|
||||||
const BrowserWindow = electron.BrowserWindow;
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@ -19,7 +20,7 @@ const logLevels = require('./enums/logLevels.js');
|
|||||||
const notify = require('./notify/electron-notify.js');
|
const notify = require('./notify/electron-notify.js');
|
||||||
const eventEmitter = require('./eventEmitter');
|
const eventEmitter = require('./eventEmitter');
|
||||||
const throttle = require('./utils/throttle.js');
|
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 { isMac, isNodeEnv, isWindows10, isWindowsOS } = require('./utils/misc');
|
||||||
const { deleteIndexFolder } = require('./search/search.js');
|
const { deleteIndexFolder } = require('./search/search.js');
|
||||||
const { isWhitelisted } = require('./utils/whitelistHandler');
|
const { isWhitelisted } = require('./utils/whitelistHandler');
|
||||||
@ -120,7 +121,20 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
const isCustomTitleBarEnabled = typeof isCustomTitleBar === 'boolean' && isCustomTitleBar && isWindows10();
|
const isCustomTitleBarEnabled = typeof isCustomTitleBar === 'boolean' && isCustomTitleBar && isWindows10();
|
||||||
|
|
||||||
log.send(logLevels.INFO, 'creating main window url: ' + url);
|
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 = {
|
let newWinOpts = {
|
||||||
title: 'Symphony',
|
title: 'Symphony',
|
||||||
show: true,
|
show: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user