Revert "feature: `Git.exe` 代理,添加 `是否代理HTTP请求` 的配置项 (#349)"
This reverts commit 4065acb686
.
pull/350/head
parent
4065acb686
commit
7760939072
|
@ -3,7 +3,6 @@ module.exports = {
|
|||
enabled: false,
|
||||
tip: '如果你没有安装git命令行则不需要启动它',
|
||||
setting: {
|
||||
proxyHttp: false, // Git.exe 是否代理HTTP请求
|
||||
sslVerify: true // Git.exe 是否关闭sslVerify,true=关闭 false=开启
|
||||
sslVerify: true // 是否关闭sslVerify
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,28 +23,15 @@ const Plugin = function (context) {
|
|||
},
|
||||
|
||||
async setProxy (ip, port) {
|
||||
// 代理https
|
||||
const ret = await shell.exec([`git config --global https.proxy http://${ip}:${port} `], { type: 'cmd' })
|
||||
|
||||
try {
|
||||
if (config.get().plugin.git.setting.proxyHttp === true) {
|
||||
// 代理http
|
||||
await shell.exec([`git config --global http.proxy http://${ip}:${port} `], { type: 'cmd', printErrorLog: false })
|
||||
} else {
|
||||
// 尝试取消代理http
|
||||
await shell.exec(['git config --global --unset http.proxy '], { type: 'cmd', printErrorLog: false })
|
||||
}
|
||||
} catch (ignore) {
|
||||
}
|
||||
|
||||
// 恢复ssl验证
|
||||
const cmds = [
|
||||
`git config --global http.proxy http://${ip}:${port} `,
|
||||
`git config --global https.proxy http://${ip}:${port} `
|
||||
]
|
||||
if (config.get().plugin.git.setting.sslVerify === true) {
|
||||
try {
|
||||
await shell.exec(['git config --global http.sslVerify false '], { type: 'cmd', printErrorLog: false })
|
||||
} catch (ignore) {
|
||||
}
|
||||
cmds.push('git config --global http.sslVerify false ')
|
||||
}
|
||||
|
||||
const ret = await shell.exec(cmds, { type: 'cmd' })
|
||||
event.fire('status', { key: 'plugin.git.enabled', value: true })
|
||||
log.info('开启【Git】代理成功')
|
||||
|
||||
|
@ -52,23 +39,14 @@ const Plugin = function (context) {
|
|||
},
|
||||
|
||||
async unsetProxy () {
|
||||
// 取消代理https
|
||||
const ret = await shell.exec(['git config --global --unset https.proxy '], { type: 'cmd' })
|
||||
|
||||
// 尝试取消代理http
|
||||
try {
|
||||
await shell.exec(['git config --global --unset http.proxy '], { type: 'cmd', printErrorLog: false })
|
||||
} catch (ignore) {
|
||||
}
|
||||
|
||||
// 恢复ssl验证
|
||||
const cmds = [
|
||||
'git config --global --unset https.proxy ',
|
||||
'git config --global --unset http.proxy '
|
||||
]
|
||||
if (config.get().plugin.git.setting.sslVerify === true) {
|
||||
try {
|
||||
await shell.exec(['git config --global http.sslVerify true '], { type: 'cmd', printErrorLog: false })
|
||||
} catch (ignore) {
|
||||
}
|
||||
cmds.push('git config --global http.sslVerify true ')
|
||||
}
|
||||
|
||||
const ret = await shell.exec(cmds, { type: 'cmd' })
|
||||
event.fire('status', { key: 'plugin.git.enabled', value: false })
|
||||
log.info('关闭【Git】代理成功')
|
||||
return ret
|
||||
|
|
|
@ -20,14 +20,6 @@
|
|||
当前未启动
|
||||
</a-tag>
|
||||
</a-form-item>
|
||||
<a-form-item label="代理HTTP请求" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-checkbox v-model="config.plugin.git.setting.proxyHttp">
|
||||
是否代理HTTP请求
|
||||
</a-checkbox>
|
||||
<div class="form-help">
|
||||
勾选时,同时代理HTTP和HTTPS请求;不勾选时,只代理HTTPS请求
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item label="SSL校验" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||
<a-checkbox v-model="config.plugin.git.setting.sslVerify">
|
||||
关闭sslVerify
|
||||
|
|
Loading…
Reference in New Issue