From 5bc52561660333b82871edeefb285645072cbe92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicola=CC=81s=20Lo=CC=81pez?= Date: Thu, 17 Aug 2023 13:48:20 -0400 Subject: [PATCH] open external links in default browser --- app/App/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/App/index.ts b/app/App/index.ts index 98fed19..c7a59aa 100644 --- a/app/App/index.ts +++ b/app/App/index.ts @@ -3,6 +3,7 @@ import ElectronStore from 'electron-store' import {autoUpdater} from 'electron-updater' import {baseURL, browserWindowConfig, isMac} from '../env' import {registerIntraSync} from './offline/ipc' +import {shell} from 'electron' import './offline' import {checkCertsAndStartServer} from './offline/certs' @@ -74,6 +75,12 @@ export default class Main { // disable background throttling Main.mainWindow.webContents.setBackgroundThrottling(false) + // make links open in default browser + Main.mainWindow.webContents.setWindowOpenHandler(({url}) => { + shell.openExternal(url) + return {action: 'deny'} + }) + const latestURL = (store.get('latestURL') || '') as string const initialURL = latestURL.startsWith(baseURL) ? latestURL : baseURL