Skip to content

Commit

Permalink
Merge branch 'non3D' of https://github.com/bcc-code/bible-explorers i…
Browse files Browse the repository at this point in the history
…nto non3D
  • Loading branch information
bogdaniculae committed Apr 11, 2024
2 parents ac0d7c2 + 2b90ac7 commit da2c973
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ const openWindow = (url: string) => {
// restoring settings works fine on Mac. Maybe other environments need additional code to deal with changing monitor setups. See https://github.com/electron/electron/issues/526
if (bounds) window.setBounds(bounds);

window.webContents.setWindowOpenHandler(({ url }) => {
// Keep default behavior for the app's protocol
if (url.startsWith(`${PRODUCTION_APP_PROTOCOL}://`)) {
return { action: 'allow' };
}

// Otherwise, open the URL in the default browser
shell.openExternal(url);

return { action: 'deny' };
});

window.webContents.on("will-navigate", (e, _url) => {
// Some links from the API have the fixed domain `explorers.biblekids.io` on the `http(s)` protocol. Use our router instead of navigating (which means reloading the "app").
if (/^https?:\/\/explorers\.biblekids\.io\//.test(_url)) {
Expand Down

0 comments on commit da2c973

Please sign in to comment.