MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / saveProxyConfig

Function saveProxyConfig

apps/desktop/main/network/proxy.ts:86–98  ·  view source on GitHub ↗
(config: ProxyConfig)

Source from the content-addressed store, hash-verified

84 * 保存代理配置
85 */
86export async function saveProxyConfig(config: ProxyConfig): Promise<void> {
87 const configPath = getConfigPath()
88 const dir = path.dirname(configPath)
89
90 if (!fs.existsSync(dir)) {
91 fs.mkdirSync(dir, { recursive: true })
92 }
93
94 fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8')
95
96 // 保存后立即应用代理设置到 Electron session
97 await applyProxyToSession()
98}
99
100/**
101 * 验证代理 URL 格式

Callers 1

registerNetworkHandlersFunction · 0.90

Calls 2

applyProxyToSessionFunction · 0.85
getConfigPathFunction · 0.70

Tested by

no test coverage detected