Skip to content

Commit

Permalink
Merge pull request #377 from krassowski/electron-15
Browse files Browse the repository at this point in the history
Upgrade to Electron 15
  • Loading branch information
mbektas authored Feb 16, 2022
2 parents 29a5980 + ea6e8b7 commit 6980447
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"@types/yargs": "^16.0.0",
"@yarnpkg/lockfile": "~1.1.0",
"css-loader": "~5.1.1",
"electron": "^14.0.0",
"electron": "^15.0.0",
"electron-builder": "^22.11.11",
"file-loader": "~6.2.0",
"fs-extra": "~9.1.0",
Expand Down
9 changes: 6 additions & 3 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,13 @@ app.on('ready', () => {
});

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

// handle page's beforeunload prompt natively
Expand Down
4 changes: 3 additions & 1 deletion src/main/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ class JupyterLabSession {
title: 'JupyterLab',
webPreferences: {
nodeIntegration: true,
contextIsolation: false
contextIsolation: false,
// disable native window open to prevent exposing node.js scripts in popups
nativeWindowOpen: false
}
});

Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f"
integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA==

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

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

Expand Down

0 comments on commit 6980447

Please sign in to comment.