1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen 2021-11-02 16:54:05 +02:00
parent ed7d9f4541
commit d0416a783f
No known key found for this signature in database
GPG Key ID: 54B44603D251B788

View File

@ -76,10 +76,13 @@ export function getWinRootCA(): Promise<string[]> {
* Add (or merge) CAs to https.globalAgent.options.ca
*/
export function injectCAs(CAs: string[]) {
const oldCAs = [https.globalAgent.options.ca].flat();
const injectedCAs = new Set([...oldCAs, ...CAs]);
https.globalAgent.options.ca = [...injectedCAs];
for (const cert of CAs) {
if (Array.isArray(https.globalAgent.options.ca) && !https.globalAgent.options.ca.includes(cert)) {
https.globalAgent.options.ca.push(cert);
} else {
https.globalAgent.options.ca = [cert];
}
}
}
/**