From 9379310ab78080459c4dba811da313364638b3ed Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Thu, 4 Jan 2024 09:29:09 +0100 Subject: [PATCH] fix open links --- apps/remixdesktop/src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/remixdesktop/src/main.ts b/apps/remixdesktop/src/main.ts index ed02946993..1b75ec0216 100644 --- a/apps/remixdesktop/src/main.ts +++ b/apps/remixdesktop/src/main.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, dialog, Menu, MenuItem, utilityProcess } from 'electron'; +import { app, BrowserWindow, dialog, Menu, MenuItem, shell, utilityProcess } from 'electron'; import path from 'path'; @@ -27,6 +27,10 @@ export const createWindow = async (dir?: string): Promise => { preload: path.join(__dirname, 'preload.js') }, }); + mainWindow.webContents.setWindowOpenHandler((details) => { + shell.openExternal(details.url); // Open URL in user's browser. + return { action: "deny" }; // Prevent the app from opening the URL. + }) if (dir && dir.endsWith('/')) dir = dir.slice(0, -1) const params = dir ? `?opendir=${encodeURIComponent(dir)}` : ''; // and load the index.html of the app.