mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
enforce loading urls to https only
This commit is contained in:
parent
923bd3ba1a
commit
2f38ea0049
@ -306,7 +306,7 @@ function createWin(urlFromConfig) {
|
|||||||
// add https protocol if none found.
|
// add https protocol if none found.
|
||||||
let parsedUrl = nodeURL.parse(urlFromConfig);
|
let parsedUrl = nodeURL.parse(urlFromConfig);
|
||||||
|
|
||||||
if (!parsedUrl.protocol) {
|
if (!parsedUrl.protocol || parsedUrl.protocol !== 'https') {
|
||||||
parsedUrl.protocol = 'https:';
|
parsedUrl.protocol = 'https:';
|
||||||
parsedUrl.slashes = true
|
parsedUrl.slashes = true
|
||||||
}
|
}
|
||||||
|
@ -76,11 +76,17 @@ function removeWindowKey(key) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parsed url
|
* Gets the parsed url
|
||||||
* @param url
|
* @returns {String}
|
||||||
* @returns {Url}
|
* @param appUrl
|
||||||
*/
|
*/
|
||||||
function getParsedUrl(url) {
|
function getParsedUrl(appUrl) {
|
||||||
return nodeURL.parse(url);
|
let parsedUrl = nodeURL.parse(appUrl);
|
||||||
|
if (!parsedUrl.protocol || parsedUrl.protocol !== 'https') {
|
||||||
|
parsedUrl.protocol = 'https:';
|
||||||
|
parsedUrl.slashes = true
|
||||||
|
}
|
||||||
|
let url = nodeURL.format(parsedUrl);
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,7 +336,7 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
|||||||
mainWindow.webContents.on('new-window', handleNewWindow);
|
mainWindow.webContents.on('new-window', handleNewWindow);
|
||||||
|
|
||||||
function handleNewWindow(event, newWinUrl, frameName, disposition, newWinOptions) {
|
function handleNewWindow(event, newWinUrl, frameName, disposition, newWinOptions) {
|
||||||
|
|
||||||
let newWinParsedUrl = getParsedUrl(newWinUrl);
|
let newWinParsedUrl = getParsedUrl(newWinUrl);
|
||||||
let mainWinParsedUrl = getParsedUrl(url);
|
let mainWinParsedUrl = getParsedUrl(url);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user