mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 01:11:13 -06:00
SDA-4450 pod load failure should retry loading pod URL from config (#2069)
* SDA-4450 pod load failure should retry loading pod URL from config * Upgrade electron@28.1.3 * SDA-4450 Fix wrong regex on pod url check
This commit is contained in:
parent
b862bd5561
commit
bafe62616d
14
package-lock.json
generated
14
package-lock.json
generated
@ -40,7 +40,7 @@
|
|||||||
"builder-util-runtime": "^9.0.3",
|
"builder-util-runtime": "^9.0.3",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"del": "3.0.0",
|
"del": "3.0.0",
|
||||||
"electron": "^27.2.0",
|
"electron": "^28.1.3",
|
||||||
"electron-builder": "^24.2.1",
|
"electron-builder": "^24.2.1",
|
||||||
"electron-icon-maker": "0.0.5",
|
"electron-icon-maker": "0.0.5",
|
||||||
"electron-osx-sign": "^0.6.0",
|
"electron-osx-sign": "^0.6.0",
|
||||||
@ -6633,9 +6633,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "27.2.0",
|
"version": "28.1.3",
|
||||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-27.2.0.tgz",
|
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz",
|
||||||
"integrity": "sha512-no/iMICVLI/5G0IqgKFbB89HDN88DWwKeRO+dPfJPkpJISdEX8Cx/sMEOFuuRa4VNInNe5CKCqRWExK5z3AdcQ==",
|
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -22991,9 +22991,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "27.2.0",
|
"version": "28.1.3",
|
||||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-27.2.0.tgz",
|
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz",
|
||||||
"integrity": "sha512-no/iMICVLI/5G0IqgKFbB89HDN88DWwKeRO+dPfJPkpJISdEX8Cx/sMEOFuuRa4VNInNe5CKCqRWExK5z3AdcQ==",
|
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@electron/get": "^2.0.0",
|
"@electron/get": "^2.0.0",
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
"builder-util-runtime": "^9.0.3",
|
"builder-util-runtime": "^9.0.3",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"del": "3.0.0",
|
"del": "3.0.0",
|
||||||
"electron": "^27.2.0",
|
"electron": "^28.1.3",
|
||||||
"electron-builder": "^24.2.1",
|
"electron-builder": "^24.2.1",
|
||||||
"electron-icon-maker": "0.0.5",
|
"electron-icon-maker": "0.0.5",
|
||||||
"electron-osx-sign": "^0.6.0",
|
"electron-osx-sign": "^0.6.0",
|
||||||
|
@ -77,6 +77,7 @@ import {
|
|||||||
initSysTray,
|
initSysTray,
|
||||||
injectStyles,
|
injectStyles,
|
||||||
isSymphonyReachable,
|
isSymphonyReachable,
|
||||||
|
isValidUrl,
|
||||||
loadBrowserViews,
|
loadBrowserViews,
|
||||||
monitorNetworkInterception,
|
monitorNetworkInterception,
|
||||||
preventWindowNavigation,
|
preventWindowNavigation,
|
||||||
@ -130,8 +131,6 @@ export const IS_NODE_INTEGRATION_ENABLED: boolean = false;
|
|||||||
export const AUX_CLICK = 'Auxclick';
|
export const AUX_CLICK = 'Auxclick';
|
||||||
// Timeout on restarting SDA in case it's stuck
|
// Timeout on restarting SDA in case it's stuck
|
||||||
const LISTEN_TIMEOUT: number = 25 * 1000;
|
const LISTEN_TIMEOUT: number = 25 * 1000;
|
||||||
|
|
||||||
const HOSTNAME_REGEX = /^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
||||||
export class WindowHandler {
|
export class WindowHandler {
|
||||||
/**
|
/**
|
||||||
* Verifies if the url is valid and
|
* Verifies if the url is valid and
|
||||||
@ -2193,14 +2192,14 @@ export class WindowHandler {
|
|||||||
);
|
);
|
||||||
const userAgent = this.getUserAgent(this.mainWebContents);
|
const userAgent = this.getUserAgent(this.mainWebContents);
|
||||||
const urlFromConfig = config.getUserConfigFields(['url']);
|
const urlFromConfig = config.getUserConfigFields(['url']);
|
||||||
const isValidUrl =
|
const isPodUrlValid =
|
||||||
HOSTNAME_REGEX.test(urlFromConfig.url || '') ||
|
isValidUrl(urlFromConfig.url || '') ||
|
||||||
urlFromConfig.url.includes('https://local-dev.symphony.com');
|
urlFromConfig.url.includes('https://local-dev.symphony.com');
|
||||||
|
|
||||||
await this.mainWebContents.loadURL(
|
await this.mainWebContents.loadURL(
|
||||||
this.cmdUrl
|
this.cmdUrl
|
||||||
? this.cmdUrl
|
? this.cmdUrl
|
||||||
: isValidUrl
|
: isPodUrlValid
|
||||||
? urlFromConfig.url
|
? urlFromConfig.url
|
||||||
: this.globalConfig.url,
|
: this.globalConfig.url,
|
||||||
{
|
{
|
||||||
@ -2392,8 +2391,7 @@ export class WindowHandler {
|
|||||||
logger.info(
|
logger.info(
|
||||||
`window-handler: Current main window url is ${webContentsUrl}.`,
|
`window-handler: Current main window url is ${webContentsUrl}.`,
|
||||||
);
|
);
|
||||||
const reloadUrl =
|
const reloadUrl = this.userConfig.url || this.globalConfig.url;
|
||||||
webContentsUrl || this.userConfig.url || this.globalConfig.url;
|
|
||||||
logger.info(`window-handler: Trying to reload ${reloadUrl}.`);
|
logger.info(`window-handler: Trying to reload ${reloadUrl}.`);
|
||||||
const userAgent = this.getUserAgent(this.mainWebContents);
|
const userAgent = this.getUserAgent(this.mainWebContents);
|
||||||
await this.mainWebContents.loadURL(reloadUrl, { userAgent });
|
await this.mainWebContents.loadURL(reloadUrl, { userAgent });
|
||||||
|
@ -1458,3 +1458,11 @@ export const hideFullscreenWindow = (window: BrowserWindow) => {
|
|||||||
});
|
});
|
||||||
window.setFullScreen(false);
|
window.setFullScreen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isValidUrl = (text: string): false | URL => {
|
||||||
|
try {
|
||||||
|
return new URL(text);
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user