mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-26 08:51:22 -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",
|
||||
"cross-env": "7.0.3",
|
||||
"del": "3.0.0",
|
||||
"electron": "^27.2.0",
|
||||
"electron": "^28.1.3",
|
||||
"electron-builder": "^24.2.1",
|
||||
"electron-icon-maker": "0.0.5",
|
||||
"electron-osx-sign": "^0.6.0",
|
||||
@ -6633,9 +6633,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron": {
|
||||
"version": "27.2.0",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-27.2.0.tgz",
|
||||
"integrity": "sha512-no/iMICVLI/5G0IqgKFbB89HDN88DWwKeRO+dPfJPkpJISdEX8Cx/sMEOFuuRa4VNInNe5CKCqRWExK5z3AdcQ==",
|
||||
"version": "28.1.3",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz",
|
||||
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
@ -22991,9 +22991,9 @@
|
||||
}
|
||||
},
|
||||
"electron": {
|
||||
"version": "27.2.0",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-27.2.0.tgz",
|
||||
"integrity": "sha512-no/iMICVLI/5G0IqgKFbB89HDN88DWwKeRO+dPfJPkpJISdEX8Cx/sMEOFuuRa4VNInNe5CKCqRWExK5z3AdcQ==",
|
||||
"version": "28.1.3",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz",
|
||||
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@electron/get": "^2.0.0",
|
||||
|
@ -177,7 +177,7 @@
|
||||
"builder-util-runtime": "^9.0.3",
|
||||
"cross-env": "7.0.3",
|
||||
"del": "3.0.0",
|
||||
"electron": "^27.2.0",
|
||||
"electron": "^28.1.3",
|
||||
"electron-builder": "^24.2.1",
|
||||
"electron-icon-maker": "0.0.5",
|
||||
"electron-osx-sign": "^0.6.0",
|
||||
|
@ -77,6 +77,7 @@ import {
|
||||
initSysTray,
|
||||
injectStyles,
|
||||
isSymphonyReachable,
|
||||
isValidUrl,
|
||||
loadBrowserViews,
|
||||
monitorNetworkInterception,
|
||||
preventWindowNavigation,
|
||||
@ -130,8 +131,6 @@ export const IS_NODE_INTEGRATION_ENABLED: boolean = false;
|
||||
export const AUX_CLICK = 'Auxclick';
|
||||
// Timeout on restarting SDA in case it's stuck
|
||||
const LISTEN_TIMEOUT: number = 25 * 1000;
|
||||
|
||||
const HOSTNAME_REGEX = /^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
export class WindowHandler {
|
||||
/**
|
||||
* Verifies if the url is valid and
|
||||
@ -2193,14 +2192,14 @@ export class WindowHandler {
|
||||
);
|
||||
const userAgent = this.getUserAgent(this.mainWebContents);
|
||||
const urlFromConfig = config.getUserConfigFields(['url']);
|
||||
const isValidUrl =
|
||||
HOSTNAME_REGEX.test(urlFromConfig.url || '') ||
|
||||
const isPodUrlValid =
|
||||
isValidUrl(urlFromConfig.url || '') ||
|
||||
urlFromConfig.url.includes('https://local-dev.symphony.com');
|
||||
|
||||
await this.mainWebContents.loadURL(
|
||||
this.cmdUrl
|
||||
? this.cmdUrl
|
||||
: isValidUrl
|
||||
: isPodUrlValid
|
||||
? urlFromConfig.url
|
||||
: this.globalConfig.url,
|
||||
{
|
||||
@ -2392,8 +2391,7 @@ export class WindowHandler {
|
||||
logger.info(
|
||||
`window-handler: Current main window url is ${webContentsUrl}.`,
|
||||
);
|
||||
const reloadUrl =
|
||||
webContentsUrl || this.userConfig.url || this.globalConfig.url;
|
||||
const reloadUrl = this.userConfig.url || this.globalConfig.url;
|
||||
logger.info(`window-handler: Trying to reload ${reloadUrl}.`);
|
||||
const userAgent = this.getUserAgent(this.mainWebContents);
|
||||
await this.mainWebContents.loadURL(reloadUrl, { userAgent });
|
||||
|
@ -1458,3 +1458,11 @@ export const hideFullscreenWindow = (window: BrowserWindow) => {
|
||||
});
|
||||
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