在remote_config.json中,添加空的 proxy.excludeIpList,到时候添加配置时也方便。

pull/274/head
王良 2024-02-22 01:10:21 +08:00
parent 6a83041fe0
commit a7d8275b87
4 changed files with 9 additions and 8 deletions

3
.gitignore vendored
View File

@ -7,4 +7,5 @@ node_modules/
*.lock *.lock
*.log *.log
pnpm-lock.yaml pnpm-lock.yaml
package-lock.json package-lock.json
*.lnk

View File

@ -36,6 +36,10 @@
} }
} }
}, },
"proxy": {
"excludeIpList": {
}
},
"plugin": { "plugin": {
"overwall": { "overwall": {
"targets": { "targets": {

View File

@ -34,7 +34,7 @@ const ProxyPlugin = function (context) {
log.info('关闭系统代理成功') log.info('关闭系统代理成功')
return true return true
} catch (err) { } catch (err) {
log.error('关闭系统代理失败:', err) log.error('关闭系统代理失败', err)
return false return false
} }
}, },
@ -208,7 +208,7 @@ module.exports = {
// endregion // endregion
// 本地地址,无需代理 // 本地地址,无需代理
'localhost': true, localhost: true,
'localhost.*': true, // 部分VPN会在host中添加这种格式的域名指向127.0.0.1,所以也排除掉 'localhost.*': true, // 部分VPN会在host中添加这种格式的域名指向127.0.0.1,所以也排除掉
'127.*': true, '127.*': true,
'test.*': true, // 本地开发时,测试用的虚拟域名格式,无需代理 'test.*': true, // 本地开发时,测试用的虚拟域名格式,无需代理

View File

@ -48,12 +48,8 @@ async function _winSetProxy (exec, ip, port, setEnv) {
} }
} }
// http=127.0.0.1:8888;https=127.0.0.1:8888 考虑这种方式
const proxyPath = extraPath.getProxyExePath() const proxyPath = extraPath.getProxyExePath()
const execFun = 'global' await execFile(proxyPath, ['global', `http=http://${ip}:${port};https=http://${ip}:${port}`, excludeIpStr])
const proxyAddr = `http=http://${ip}:${port};https=http://${ip}:${port}`
log.info(`执行“设置系统代理”的命令: ${proxyPath} ${execFun} ${proxyAddr} ${excludeIpStr}`)
await execFile(proxyPath, [execFun, proxyAddr, excludeIpStr])
if (setEnv) { if (setEnv) {
log.info('同时设置 https_proxy') log.info('同时设置 https_proxy')