mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Whitelist: fix issues with whitelist (#902)
This commit is contained in:
parent
0880612924
commit
6df2ff1766
20
package-lock.json
generated
20
package-lock.json
generated
@ -4470,13 +4470,13 @@
|
||||
"dev": true
|
||||
},
|
||||
"diskusage": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/diskusage/-/diskusage-1.1.2.tgz",
|
||||
"integrity": "sha1-4cWRrmF1E/74HWIPRY8We55ekeY=",
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/diskusage/-/diskusage-1.1.3.tgz",
|
||||
"integrity": "sha1-aA19vxtnkWihlckkDrNVLL0sBns=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"es6-promise": "^4.2.5",
|
||||
"nan": "^2.13.2"
|
||||
"nan": "^2.14.0"
|
||||
}
|
||||
},
|
||||
"dmg-builder": {
|
||||
@ -13158,8 +13158,8 @@
|
||||
}
|
||||
},
|
||||
"screen-share-indicator-frame": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#adc3fdb0fa96629773ea2bc13b20b9ffd109ac1d",
|
||||
"version": "1.4.1",
|
||||
"resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#891c5846fcdb1e2788bebf062f0ddb1b44eec67d",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"run-script-os": "1.0.7"
|
||||
@ -13997,12 +13997,12 @@
|
||||
}
|
||||
},
|
||||
"swift-search": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/swift-search/-/swift-search-2.0.1.tgz",
|
||||
"integrity": "sha1-yWDXbBkFa9JuhQRd4Ei8ro0/HFw=",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/swift-search/-/swift-search-2.0.2.tgz",
|
||||
"integrity": "sha1-sVs8wouzV7LDacnbZfQ91V/8DxU=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"diskusage": "1.1.2",
|
||||
"diskusage": "1.1.3",
|
||||
"electron-log": "2.2.16",
|
||||
"ffi-napi": "2.4.5",
|
||||
"keymirror": "0.1.1",
|
||||
|
@ -148,6 +148,6 @@
|
||||
"optionalDependencies": {
|
||||
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet2.git#v1.0.6",
|
||||
"screen-share-indicator-frame": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#v1.4.1",
|
||||
"swift-search": "2.0.1"
|
||||
"swift-search": "2.0.2"
|
||||
}
|
||||
}
|
||||
|
@ -289,13 +289,14 @@ export const removeWindowEventListener = (window: BrowserWindow): void => {
|
||||
* @param message {string} - custom message displayed to the user
|
||||
* @param callback {function}
|
||||
*/
|
||||
export const handleSessionPermissions = (permission: boolean, message: string, callback: (permission: boolean) => void): void => {
|
||||
export const handleSessionPermissions = async (permission: boolean, message: string, callback: (permission: boolean) => void): Promise<void> => {
|
||||
logger.info(`window-action: permission is ->`, { type: message, permission });
|
||||
|
||||
if (!permission) {
|
||||
const browserWindow = BrowserWindow.getFocusedWindow();
|
||||
if (browserWindow && !browserWindow.isDestroyed()) {
|
||||
dialog.showMessageBox(browserWindow, { type: 'error', title: `${i18n.t('Permission Denied')()}!`, message });
|
||||
const response = await dialog.showMessageBox(browserWindow, { type: 'error', title: `${i18n.t('Permission Denied')()}!`, message });
|
||||
logger.error(`window-actions: permissions message box closed with response`, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,11 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
|
||||
if (!browserWindow || !windowExists(browserWindow)) {
|
||||
return;
|
||||
}
|
||||
logger.info(`window-utils: preventing window from navigating!`);
|
||||
logger.info(`window-utils: preventing window from navigating!`, isPopOutWindow);
|
||||
|
||||
const listener = (e: Electron.Event, winUrl: string) => {
|
||||
const listener = async (e: Electron.Event, winUrl: string) => {
|
||||
if (!winUrl.startsWith('http' || 'https')) {
|
||||
logger.info(`window-utils: ${winUrl} doesn't start with http or https, so, not navigating!`);
|
||||
logger.error(`window-utils: ${winUrl} doesn't start with http or https, so, not navigating!`);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
@ -74,13 +74,13 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
|
||||
if (!isValid) {
|
||||
e.preventDefault();
|
||||
if (browserWindow && windowExists(browserWindow)) {
|
||||
// @ts-ignore
|
||||
electron.dialog.showMessageBox(browserWindow, {
|
||||
const response = await electron.dialog.showMessageBox(browserWindow, {
|
||||
type: 'warning',
|
||||
buttons: [ 'OK' ],
|
||||
title: i18n.t('Not Allowed')(),
|
||||
message: `${i18n.t(`Sorry, you are not allowed to access this website`)} (${winUrl}), ${i18n.t('please contact your administrator for more details')}`,
|
||||
message: `${i18n.t(`Sorry, you are not allowed to access this website`)()} (${winUrl}), ${i18n.t('please contact your administrator for more details')()}`,
|
||||
});
|
||||
logger.info(`window-utils: received ${response} response from dialog`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,8 +90,6 @@ export const preventWindowNavigation = (browserWindow: BrowserWindow, isPopOutWi
|
||||
|| winUrl === browserWindow.webContents.getURL()) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
browserWindow.webContents.on('will-navigate', listener);
|
||||
|
Loading…
Reference in New Issue
Block a user