Skip to content

Commit

Permalink
open external links in default browser
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslopezj committed Aug 17, 2023
1 parent a65ced9 commit 5bc5256
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/App/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5bc5256

Please sign in to comment.