Introduce and use "openBrowser" (#4876)

Co-authored-by: Steven Johnstone <sjohntone@mirantis.com>
This commit is contained in:
Steven JohnstoneandSteven Johnstone authored and GitHub committed 2022-02-17 08:37:34 -05:00
1 parent 8088d3b5c2
commit 625b00c247
7 files changed
+46 -21

No files matched your search

+5 -3
View File
@@ -5,11 +5,11 @@
import type { ClusterId } from "../common/cluster-types";
import { makeObservable, observable } from "mobx";
import { app, BrowserWindow, dialog, ipcMain, shell, webContents } from "electron";
import { app, BrowserWindow, dialog, ipcMain, webContents } from "electron";
import windowStateKeeper from "electron-window-state";
import { appEventBus } from "../common/app-event-bus/event-bus";
import { ipcMainOn } from "../common/ipc";
import { delay, iter, Singleton } from "../common/utils";
import { delay, iter, Singleton, openBrowser } from "../common/utils";
import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames";
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
import logger from "./logger";
@@ -134,7 +134,9 @@ export class WindowManager extends Singleton {
webPreferences.nodeIntegration = false;
})
.setWindowOpenHandler((details) => {
shell.openExternal(details.url);
openBrowser(details.url).catch(error => {
logger.error("[WINDOW-MANAGER]: failed to open browser", { error });
});
return { action: "deny" };
});