MCPcopy
hub / github.com/docmirror/dev-sidecar / unsetProxy

Function unsetProxy

packages/core/src/modules/plugin/git/index.js:53–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51
52 // 当手动修改过 `~/.gitconfig` 时,`unset` 可能会执行失败,所以除了第一条命令外,其他命令都添加了try-catch,防止关闭Git代理失败
53 async unsetProxy () {
54 const ret = await shell.exec(['git config --global --unset http.proxy '], { type: 'cmd' })
55
56 try {
57 await shell.exec(['git config --global --unset https.proxy '], { type: 'cmd' })
58 } catch {
59 }
60
61 if (config.get().plugin.git.setting.sslVerify === true) {
62 try {
63 await shell.exec(['git config --global --unset http.sslVerify '], { type: 'cmd' })
64 } catch {
65 }
66 }
67
68 if (config.get().plugin.git.setting.noProxyUrls != null) {
69 for (const url in config.get().plugin.git.setting.noProxyUrls) {
70 try {
71 await shell.exec([`git config --global --unset http."${url}".proxy `], { type: 'cmd' })
72 } catch {
73 }
74 }
75 }
76 event.fire('status', { key: 'plugin.git.enabled', value: false })
77 log.info('关闭【Git】代理成功')
78 return ret
79 },
80 }
81 return pluginApi
82}

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
execMethod · 0.45

Tested by

no test coverage detected