Skip to content

Commit

Permalink
fix expression is always truthy
Browse files Browse the repository at this point in the history
  • Loading branch information
JustJoostNL committed Oct 18, 2024
1 parent cc7e54a commit febbf61
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export async function createMainWindow() {
});

if (process.env.VITE_DEV_SERVER_URL) {
// electron-vite-vue#298
await mainWindow.loadURL(devServerUrl);
mainWindow.webContents.openDevTools({ mode: "detach" });
mainWindow.setMenuBarVisibility(false);
Expand All @@ -104,13 +103,19 @@ export async function createMainWindow() {
}

mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith("https:" || "http:")) shell.openExternal(url);
if (url.startsWith("http:") || url.startsWith("https:")) {
shell.openExternal(url);
}
return { action: "deny" };
});

mainWindow.webContents.on(
"will-navigate",
(event: Electron.Event, url: string) => {
if (url.startsWith("https:" || "http:") && !url.includes("localhost")) {
if (
(url.startsWith("http:") || url.startsWith("https:")) &&
!url.includes("localhost")
) {
event.preventDefault();
shell.openExternal(url);
}
Expand Down

0 comments on commit febbf61

Please sign in to comment.