Browse Source

feat: 系统代理页面,添加 `是否代理HTTP请求` 的配置项 (#343)

pull/344/head
王良 3 months ago committed by GitHub
parent
commit
90ad36f11d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      packages/core/src/modules/proxy/index.js
  2. 6
      packages/core/src/shell/scripts/set-system-proxy/index.js
  3. 8
      packages/gui/src/view/pages/proxy.vue

1
packages/core/src/modules/proxy/index.js

@ -54,6 +54,7 @@ module.exports = {
name: '系统代理',
use: 'local',
other: [],
proxyHttp: true,
setEnv: false,
excludeIpList: {
// region 常用国内可访问域名

6
packages/core/src/shell/scripts/set-system-proxy/index.js

@ -50,7 +50,11 @@ async function _winSetProxy (exec, ip, port, setEnv) {
const proxyPath = extraPath.getProxyExePath()
const execFun = 'global'
const proxyAddr = `http=http://${ip}:${port};https=http://${ip}:${port}`
let proxyAddr = `https=http://${ip}:${port}`
if (config.get().proxy.proxyHttp !== false) {
proxyAddr = `http=http://${ip}:${port};` + proxyAddr
}
log.info(`执行“设置系统代理”的程序: ${proxyPath} ${execFun} ${proxyAddr} ......(省略排除IP列表)`)
await execFile(proxyPath, [execFun, proxyAddr, excludeIpStr])

8
packages/gui/src/view/pages/proxy.vue

@ -21,6 +21,14 @@
<a @click="openExternal('https://github.com/docmirror/dev-sidecar/blob/master/doc/recover.md')">卸载与恢复网络说明</a>
</div>
</a-form-item>
<a-form-item label="代理HTTP请求" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.proxy.proxyHttp" >
是否代理HTTP请求
</a-checkbox>
<div class="form-help">
勾选时同时代理HTTP和HTTPS请求不勾选时只代理HTTPS请求
</div>
</a-form-item>
<a-form-item v-if="isWindows()" label="设置环境变量" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.proxy.setEnv" >
是否同时修改HTTPS_PROXY环境变量不好用不建议勾选

Loading…
Cancel
Save