From 0abad98295d3ec17a6f8ab8b0c3c82f8bf8e2a53 Mon Sep 17 00:00:00 2001 From: Oj Date: Fri, 11 Feb 2022 08:35:04 +0000 Subject: [PATCH] [SecurityUtils] Remove as unneeded --- src/bootstrap.js | 3 --- src/splash/index.js | 11 ----------- src/utils/securityUtils.js | 7 ------- 3 files changed, 21 deletions(-) delete mode 100644 src/utils/securityUtils.js diff --git a/src/bootstrap.js b/src/bootstrap.js index 62ae0bc..1d392ea 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -65,9 +65,6 @@ const startCore = () => { GPUSettings, updater, crashReporterSetup, - - // OpenCore additionals (non-standard) - securityUtils: require('./utils/securityUtils.js') }); const i = setImmediate(() => { diff --git a/src/splash/index.js b/src/splash/index.js index 0692ca8..3b0a551 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -24,8 +24,6 @@ var moduleUpdater = _interopRequireWildcard(require("../updater/moduleUpdater")) var paths = _interopRequireWildcard(require("../paths")); -var _securityUtils = require("../utils/securityUtils"); - var _updater = require("../updater/updater"); const ipcMain = _electron.ipcMain; @@ -389,15 +387,6 @@ function launchSplashWindow(startMinimized) { splashWindow = new _electron.BrowserWindow(windowConfig); // prevent users from dropping links to navigate in splash window log('Splash', 'Created BrowserWindow'); - splashWindow.webContents.on('will-navigate', e => e.preventDefault()); - splashWindow.webContents.on('new-window', (e, windowURL) => { - e.preventDefault(); - (0, _securityUtils.saferShellOpenExternal)(windowURL); // exit, but delay half a second because openExternal is about to fire - // some events to things that are freed by app.quit. - - setTimeout(_electron.app.quit, 500); - }); - if (process.platform !== 'darwin') { // citron note: this causes a crash on quit while the window is open on osx splashWindow.on('closed', () => { diff --git a/src/utils/securityUtils.js b/src/utils/securityUtils.js deleted file mode 100644 index df92a07..0000000 --- a/src/utils/securityUtils.js +++ /dev/null @@ -1,7 +0,0 @@ -const { shell } = require('electron'); - -const allowedProtocols = [ 'https', 'http' ]; // Only allow some protocols -exports.saferShellOpenExternal = (url) => allowedProtocols.includes(url.split(':')[0].toLowerCase()) ? shell.openExternal(url) : Promise.reject(); - -const oParse = (u) => u.split('/').slice(0, 3).join('/'); -exports.checkUrlOriginMatches = (a, b) => oParse(a) === oParse(b); \ No newline at end of file