MCPcopy Create free account
hub / github.com/6174/comflowyspace / parseWindowsProxySettings

Function parseWindowsProxySettings

apps/node/src/modules/utils/env.ts:93–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93async function parseWindowsProxySettings() {
94 try {
95 const regedit = require('regedit');
96 const path = require('path');
97 const isProduction = (process as any).mainModule?.filename?.includes('app.asar');
98 if (isProduction) {
99 const scriptPath = path.join((process as any).resourcesPath, 'assets', 'vbs');
100 regedit.setExternalVBSLocation(scriptPath);
101 }
102 const key = "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
103 const proxySettings = (await regedit.promisified.list(key))[key].values;
104
105 const ret = {
106 enabled: proxySettings.ProxyEnable.value,
107 server: proxySettings.ProxyServer.value,
108 override: proxySettings.ProxyOverride.value
109 };
110
111 if (ret.enabled && ret.server) {
112 const server = "http://" + ret.server;
113 systemProxy.all_proxy = server;
114 systemProxy.http_proxy = server;
115 systemProxy.https_proxy = server;
116 }
117
118 } catch (err: any) {
119 logger.error("get system proxy error" + err.message + err.stack)
120 console.log("read error", err);
121 }
122}

Callers 1

getSystemProxyFunction · 0.70

Calls 1

logMethod · 0.80

Tested by

no test coverage detected