diff --git a/electron-3d-app/package.json b/electron-3d-app/package.json index d6bddbd..65a9dc3 100644 --- a/electron-3d-app/package.json +++ b/electron-3d-app/package.json @@ -17,6 +17,7 @@ "@electron-forge/maker-rpm": "^7.4.0", "@electron-forge/maker-squirrel": "^7.4.0", "@electron-forge/maker-zip": "^7.4.0", + "@electron-forge/maker-dmg": "^7.4.0", "@electron-forge/plugin-auto-unpack-natives": "^7.4.0", "@electron-forge/plugin-fuses": "^7.4.0", "@electron/fuses": "^1.8.0", @@ -29,7 +30,6 @@ }, "license": "MIT", "dependencies": { - "@electron-forge/maker-dmg": "^7.4.0", "custom-electron-prompt": "^1.5.7", "electron-squirrel-startup": "^1.0.1", "jspython-interpreter": "^2.1.15", diff --git a/electron-3d-app/src/favicon.ico b/electron-3d-app/src/favicon.ico new file mode 100644 index 0000000..c488275 Binary files /dev/null and b/electron-3d-app/src/favicon.ico differ diff --git a/electron-3d-app/src/index.js b/electron-3d-app/src/index.js index f163db7..6001f07 100644 --- a/electron-3d-app/src/index.js +++ b/electron-3d-app/src/index.js @@ -26,7 +26,8 @@ const createWindow = () => { webPreferences: { preload: path.join(__dirname, 'preload.js'), }, - nodeIntegration: true + nodeIntegration: true, + icon: path.join(__dirname, 'favicon.ico'), }); mainWindow.setMenu(null); @@ -72,6 +73,13 @@ const createWindow = () => { menu.popup(); }); + mainWindow.webContents.on('will-navigate', (details, url, isInPlace, isMainFrame, frameProcessId, frameRoutingId) => { + if (!url.startsWith(config.serverUrl)) { + details.preventDefault(); + shell.openExternal(url); + } + }) + ipcMain.on("config-change", (event) => { prompt({ title: "Configuration", label: "Please provide the server URL and port:", inputAttrs: { type: 'url' }, type: "input", value: config.serverUrl }).then((value) => { if (value !== null) {