Fix opening external links from confirmation dialog box on desktop app

This commit is contained in:
Debanjum Singh Solanky 2024-03-14 02:29:22 +05:30
parent 3abe7ccb26
commit 1aeea3d854

View file

@ -384,10 +384,10 @@ const createWindow = (tab = 'chat.html') => {
// Open external links in link handler registered on OS (e.g. browser) // Open external links in link handler registered on OS (e.g. browser)
win.webContents.setWindowOpenHandler(async ({ url }) => { win.webContents.setWindowOpenHandler(async ({ url }) => {
const shouldOpen = { response: 0 }; let shouldOpen = { response: 0 };
if (!url.startsWith('http://')) { if (!url.startsWith(store.get('hostURL'))) {
// Confirm before opening non-HTTP links // Confirm before opening external links
const confirmNotice = `Do you want to open this link? It will be handled by an external application.\n\n${url}`; const confirmNotice = `Do you want to open this link? It will be handled by an external application.\n\n${url}`;
shouldOpen = await dialog.showMessageBox({ shouldOpen = await dialog.showMessageBox({
type: 'question', type: 'question',