Skip to content

Commit 6980447

Browse files
authored
Merge pull request #377 from krassowski/electron-15
Upgrade to Electron 15
2 parents 29a5980 + ea6e8b7 commit 6980447

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"@types/yargs": "^16.0.0",
150150
"@yarnpkg/lockfile": "~1.1.0",
151151
"css-loader": "~5.1.1",
152-
"electron": "^14.0.0",
152+
"electron": "^15.0.0",
153153
"electron-builder": "^22.11.11",
154154
"file-loader": "~6.2.0",
155155
"fs-extra": "~9.1.0",

src/main/main.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,13 @@ app.on('ready', () => {
190190
});
191191

192192
app.on("web-contents-created", (_event: any, webContents: WebContents) => {
193-
// Prevent navigation
193+
// Prevent navigation to local links on the same page and external links
194194
webContents.on('will-navigate', (event: Event, navigationUrl) => {
195-
console.warn(`Navigation is not allowed; attempted navigation to: ${navigationUrl}`);
196-
event.preventDefault();
195+
const jlabBaseUrl = `http://localhost:${appConfig.jlabPort}/`;
196+
if (!(navigationUrl.startsWith(jlabBaseUrl) && navigationUrl.indexOf('#') === -1)) {
197+
console.warn(`Navigation is not allowed; attempted navigation to: ${navigationUrl}`);
198+
event.preventDefault();
199+
}
197200
});
198201

199202
// handle page's beforeunload prompt natively

src/main/sessions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ class JupyterLabSession {
403403
title: 'JupyterLab',
404404
webPreferences: {
405405
nodeIntegration: true,
406-
contextIsolation: false
406+
contextIsolation: false,
407+
// disable native window open to prevent exposing node.js scripts in popups
408+
nativeWindowOpen: false
407409
}
408410
});
409411

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f"
8989
integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA==
9090

91-
"@electron/get@^1.0.1":
91+
"@electron/get@^1.13.0":
9292
version "1.13.1"
9393
resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.13.1.tgz#42a0aa62fd1189638bd966e23effaebb16108368"
9494
integrity sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==
@@ -3364,12 +3364,12 @@ electron-to-chromium@^1.4.17:
33643364
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.24.tgz#9cf8a92d5729c480ee47ff0aa5555f57467ae2fa"
33653365
integrity sha512-erwx5r69B/WFfFuF2jcNN0817BfDBdC4765kQ6WltOMuwsimlQo3JTEq0Cle+wpHralwdeX3OfAtw/mHxPK0Wg==
33663366

3367-
electron@^14.0.0:
3368-
version "14.2.3"
3369-
resolved "https://registry.yarnpkg.com/electron/-/electron-14.2.3.tgz#3facf572c57cefe8ce80154ad3e63f937784644b"
3370-
integrity sha512-7wBqvzUKhK1tw544w3+F8J7NajnqURGC4pH3VFTiBHU5ayiI/oaTTXJxyFLZ54zsR7xwon/3dYEVjIm2i68+Zg==
3367+
electron@^15.0.0:
3368+
version "15.3.4"
3369+
resolved "https://registry.yarnpkg.com/electron/-/electron-15.3.4.tgz#811e8872f4500b88ad49e005cbe8f93e10676f6d"
3370+
integrity sha512-GLTE+UEKw1pJehkgpLgXtsHhYqSPp6skSNY1bxnY3dDYBrsPlP3nTEO9YQY2p4eHk+uxFVTXOVy5afcu9fIZ9A==
33713371
dependencies:
3372-
"@electron/get" "^1.0.1"
3372+
"@electron/get" "^1.13.0"
33733373
"@types/node" "^14.6.2"
33743374
extract-zip "^1.0.3"
33753375

0 commit comments

Comments
 (0)