mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Helper to resolve proxy from URL in any environment, or using extension-API (#5690)
* Permit modular directory structures for behaviours in spirit of "Screaming Architecture" Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Implement env-agnostic helper to resolve proxy from URL Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Implement way to resolve a proxy, that is not reliant on existing windows Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Restore reliancy on existing windows for resolving proxy for fears of Electron events misbehaving because of a temp-window used in case no windows are open Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Make resolving a proxy throw if no browser window is available Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Extract minimal abstraction for specifically logging error instead of also warn, info, etc. Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Make decorator for error logging not create orphan promise for easier controllability Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Add error logging to resolving of proxy Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Expose resolving of proxy in extension-API Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Add missing general override Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Add test to add documentation Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Disperse implementation of resolve-proxy back to conventional directory structure instead of an experimental one Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Revert "Permit modular directory structures for behaviours in spirit of "Screaming Architecture"" This reverts commit 75e1231b0e61b74d030d12365352226e7f1ce500. Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Rename a helper for less ambiguity Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> * Add tsdoc for "resolveSystemProxy" exposed in Extension-API Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
1 parent
fa23b5cd3f
commit
71427da02d
15 files changed
+432
-27
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 { resolveSystemProxyInjectionToken } from "../../../common/utils/resolve-system-proxy/resolve-system-proxy-injection-token";
|
||||
import requestFromChannelInjectable from "../channel/request-from-channel.injectable";
|
||||
import resolveSystemProxyChannelInjectable from "../../../common/utils/resolve-system-proxy/resolve-system-proxy-channel.injectable";
|
||||
|
||||
const resolveSystemProxyInjectable = getInjectable({
|
||||
id: "resolve-system-proxy-for-renderer",
|
||||
|
||||
instantiate: (di) => {
|
||||
const requestFromChannel = di.inject(requestFromChannelInjectable);
|
||||
const resolveSystemProxyChannel = di.inject(resolveSystemProxyChannelInjectable);
|
||||
|
||||
return async (url) => requestFromChannel(resolveSystemProxyChannel, url);
|
||||
},
|
||||
|
||||
injectionToken: resolveSystemProxyInjectionToken,
|
||||
});
|
||||
|
||||
export default resolveSystemProxyInjectable;
|
||||
Reference in new issue
Block a user