mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove usage of deprecated xtermjs's registerLinkMatcher API (#5996)
* Make openBrowser->openLinkInBrowser injectable Signed-off-by: Sebastian Malton <sebastian@malton.name> * Remove use of deprecated link matcher API from XtermJS Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
5c11d7f7fe
commit
09f2919946
17 files changed
+144
-77
No files matched your search
@@ -5,7 +5,6 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { docsUrl, productName, supportUrl } from "../../common/vars";
|
||||
import { broadcastMessage } from "../../common/ipc";
|
||||
import { openBrowser } from "../../common/utils";
|
||||
import type { MenuItemConstructorOptions } from "electron";
|
||||
import { webContents } from "electron";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
@@ -25,6 +24,7 @@ import applicationWindowInjectable from "../start-main-application/lens-window/a
|
||||
import reloadWindowInjectable from "../start-main-application/lens-window/reload-window.injectable";
|
||||
import showApplicationWindowInjectable from "../start-main-application/lens-window/show-application-window.injectable";
|
||||
import processCheckingForUpdatesInjectable from "../application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||
import openLinkInBrowserInjectable from "../../common/utils/open-link-in-browser.injectable";
|
||||
|
||||
function ignoreIf(check: boolean, menuItems: MenuItemOpts[]) {
|
||||
return check ? [] : menuItems;
|
||||
@@ -54,6 +54,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
||||
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
|
||||
const stopServicesAndExitApp = di.inject(stopServicesAndExitAppInjectable);
|
||||
const processCheckingForUpdates = di.inject(processCheckingForUpdatesInjectable);
|
||||
const openLinkInBrowser = di.inject(openLinkInBrowserInjectable);
|
||||
|
||||
logger.info(`[MENU]: autoUpdateEnabled=${updatingIsEnabled}`);
|
||||
|
||||
@@ -260,7 +261,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
||||
label: "Documentation",
|
||||
id: "documentation",
|
||||
click: async () => {
|
||||
openBrowser(docsUrl).catch((error) => {
|
||||
openLinkInBrowser(docsUrl).catch((error) => {
|
||||
logger.error("[MENU]: failed to open browser", { error });
|
||||
});
|
||||
},
|
||||
@@ -269,7 +270,7 @@ const applicationMenuItemsInjectable = getInjectable({
|
||||
label: "Support",
|
||||
id: "support",
|
||||
click: async () => {
|
||||
openBrowser(supportUrl).catch((error) => {
|
||||
openLinkInBrowser(supportUrl).catch((error) => {
|
||||
logger.error("[MENU]: failed to open browser", { error });
|
||||
});
|
||||
},
|
||||
|
||||
+3
-2
@@ -6,10 +6,10 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../../common/logger.injectable";
|
||||
import applicationWindowStateInjectable from "./application-window-state.injectable";
|
||||
import { BrowserWindow } from "electron";
|
||||
import { openBrowser } from "../../../../common/utils";
|
||||
import sendToChannelInElectronBrowserWindowInjectable from "./send-to-channel-in-electron-browser-window.injectable";
|
||||
import type { ElectronWindow } from "./create-lens-window.injectable";
|
||||
import type { RequireExactlyOne } from "type-fest";
|
||||
import openLinkInBrowserInjectable from "../../../../common/utils/open-link-in-browser.injectable";
|
||||
|
||||
export type ElectronWindowTitleBarStyle = "hiddenInset" | "hidden" | "default" | "customButtonsOnHover";
|
||||
|
||||
@@ -46,6 +46,7 @@ const createElectronWindowInjectable = getInjectable({
|
||||
instantiate: (di): CreateElectronWindow => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const sendToChannelInLensWindow = di.inject(sendToChannelInElectronBrowserWindowInjectable);
|
||||
const openLinkInBrowser = di.inject(openLinkInBrowserInjectable);
|
||||
|
||||
return (configuration) => {
|
||||
const applicationWindowState = di.inject(
|
||||
@@ -158,7 +159,7 @@ const createElectronWindowInjectable = getInjectable({
|
||||
})
|
||||
|
||||
.setWindowOpenHandler((details) => {
|
||||
openBrowser(details.url).catch((error) => {
|
||||
openLinkInBrowser(details.url).catch((error) => {
|
||||
logger.error("[CREATE-ELECTRON-WINDOW]: failed to open browser", {
|
||||
error,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user