feat: cfg electron to open links in new window (#934)

Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
marcelle
2025-01-31 13:17:29 -05:00
committed by GitHub
parent 23ae315907
commit 7a427c6d46
3 changed files with 44 additions and 35 deletions
+10
View File
@@ -171,6 +171,16 @@ const createChat = async (app, query?: string, dir?: string, version?: string) =
},
});
// Handle new window creation for links
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
// Open all links in external browser
if (url.startsWith('http:') || url.startsWith('https:')) {
require('electron').shell.openExternal(url);
return { action: 'deny' };
}
return { action: 'allow' };
});
// Load the index.html of the app.
const queryParam = query ? `?initialQuery=${encodeURIComponent(query)}` : '';
const { screen } = require('electron');