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

Merge branch 'master' into monorepo

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2023-01-24 19:36:16 +02:00
commit d8f4487480
12 changed files with 77 additions and 11 deletions

View File

@ -0,0 +1,8 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getRequestChannel } from "../../../common/utils/channel/get-request-channel";
export const casChannel = getRequestChannel<void, string[]>("certificate-authorities");

View File

@ -0,0 +1,13 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
import { casChannel } from "../common/channel";
import certificateAuthoritiesChannelListenerInjectable from "./channel-handler.injectable";
export default getGlobalOverride(certificateAuthoritiesChannelListenerInjectable, () => ({
channel: casChannel,
handler: () => [],
}));

View File

@ -0,0 +1,25 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getRequestChannelListenerInjectable } from "../../../main/utils/channel/channel-listeners/listener-tokens";
import { casChannel } from "../common/channel";
import { globalAgent } from "https";
import { isString } from "../../../common/utils";
const certificateAuthoritiesChannelListenerInjectable = getRequestChannelListenerInjectable({
channel: casChannel,
handler: () => () => {
if (Array.isArray(globalAgent.options.ca)) {
return globalAgent.options.ca.filter(isString);
}
if (typeof globalAgent.options.ca === "string") {
return [globalAgent.options.ca];
}
return [];
},
});
export default certificateAuthoritiesChannelListenerInjectable;

View File

@ -3,10 +3,10 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import execFileInjectable from "../fs/exec-file.injectable";
import loggerInjectable from "../logger.injectable";
import type { AsyncResult } from "../utils/async-result";
import { requestSystemCAsInjectionToken } from "./request-system-cas-token";
import execFileInjectable from "../../../common/fs/exec-file.injectable";
import loggerInjectable from "../../../common/logger.injectable";
import type { AsyncResult } from "../../../common/utils/async-result";
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet#other_assertions
const certSplitPattern = /(?=-----BEGIN\sCERTIFICATE-----)/g;

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { requestSystemCAsInjectionToken } from "./request-system-cas-token";
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
const requestSystemCAsInjectable = getInjectable({
id: "request-system-cas",

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { requestSystemCAsInjectionToken } from "./request-system-cas-token";
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
const requestSystemCAsInjectable = getInjectable({
id: "request-system-cas",

View File

@ -3,9 +3,9 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import execFileInjectable from "../fs/exec-file.injectable";
import loggerInjectable from "../logger.injectable";
import { requestSystemCAsInjectionToken } from "./request-system-cas-token";
import execFileInjectable from "../../../common/fs/exec-file.injectable";
import loggerInjectable from "../../../common/logger.injectable";
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
const pemEncoding = (hexEncodedCert: String) => {
const certData = Buffer.from(hexEncodedCert, "hex").toString("base64");

View File

@ -0,0 +1,20 @@
/**
* 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 { requestFromChannelInjectionToken } from "../../../common/utils/channel/request-from-channel-injection-token";
import { casChannel } from "../common/channel";
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
const requestSystemCAsInjectable = getInjectable({
id: "request-system-cas",
instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
return () => requestFromChannel(casChannel);
},
injectionToken: requestSystemCAsInjectionToken,
});
export default requestSystemCAsInjectable;

View File

@ -4,7 +4,7 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";
import injectSystemCAsInjectable from "../../../common/certificate-authorities/inject-system-cas.injectable";
import injectSystemCAsInjectable from "../../../features/certificate-authorities/common/inject-system-cas.injectable";
const setupSystemCaInjectable = getInjectable({
id: "setup-system-ca",

View File

@ -4,7 +4,7 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import { beforeFrameStartsSecondInjectionToken } from "../../before-frame-starts/tokens";
import injectSystemCAsInjectable from "../../../common/certificate-authorities/inject-system-cas.injectable";
import injectSystemCAsInjectable from "../../../features/certificate-authorities/common/inject-system-cas.injectable";
const setupSystemCaInjectable = getInjectable({
id: "setup-system-ca",