1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

resolve system proxy window: load blank page

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2023-03-20 10:24:28 +02:00
parent 090f8be9ef
commit a72ec0d984
2 changed files with 6 additions and 23 deletions

View File

@ -1,23 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { beforeQuitOfFrontEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
import resolveSystemProxyWindowInjectable from "./resolve-system-proxy-window.injectable";
const destroyResolveSystemProxyWindowInjectable = getInjectable({
id: "destroy-resolev-system-proxy-window",
instantiate: (di) => ({
run: () => {
di.inject(resolveSystemProxyWindowInjectable).destroy();
return undefined;
},
}),
injectionToken: beforeQuitOfFrontEndInjectionToken,
});
export default destroyResolveSystemProxyWindowInjectable;

View File

@ -13,8 +13,14 @@ const resolveSystemProxyFromElectronInjectable = getInjectable({
const helperWindow = di.inject(resolveSystemProxyWindowInjectable); const helperWindow = di.inject(resolveSystemProxyWindowInjectable);
const withErrorLoggingFor = di.inject(withErrorLoggingInjectable); const withErrorLoggingFor = di.inject(withErrorLoggingInjectable);
const withErrorLogging = withErrorLoggingFor(() => "Error resolving proxy"); const withErrorLogging = withErrorLoggingFor(() => "Error resolving proxy");
let loaded = false;
return withErrorLogging(async (url: string) => { return withErrorLogging(async (url: string) => {
if (!loaded) {
await helperWindow.loadURL("about:blank");
loaded = true;
}
return await helperWindow.webContents.session.resolveProxy(url); return await helperWindow.webContents.session.resolveProxy(url);
}); });
}, },