From 74d78207bf4eeaa64f7486725f5d7a6777ecf823 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com>
Date: Fri, 24 Jan 2025 17:27:08 +0800
Subject: [PATCH] =?UTF-8?q?feature:=20=E7=B3=BB=E7=BB=9F=E4=BB=A3=E7=90=86?=
=?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8E=92=E9=99=A4=E5=9F=9F=E5=90=8D?=
=?UTF-8?q?=EF=BC=8C=E5=8F=AF=E9=85=8D=E7=BD=AE=E4=B8=BA=E4=B8=8D=E6=8E=92?=
=?UTF-8?q?=E9=99=A4=EF=BC=8C=E7=94=A8=E4=BA=8E=E7=BB=A7=E7=BB=AD=E4=BB=A3?=
=?UTF-8?q?=E7=90=86=E5=9B=BD=E5=86=85=E5=9F=9F=E5=90=8D=E7=99=BD=E5=90=8D?=
=?UTF-8?q?=E5=8D=95=E4=B8=AD=E7=9A=84=E5=9F=9F=E5=90=8D=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../shell/scripts/set-system-proxy/index.js | 22 ++++++++----
.../gui/src/view/pages/plugin/overwall.vue | 16 ++++-----
packages/gui/src/view/pages/proxy.vue | 34 +++++++++++++++----
3 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/packages/core/src/shell/scripts/set-system-proxy/index.js b/packages/core/src/shell/scripts/set-system-proxy/index.js
index 85201126b4..2152372e31 100644
--- a/packages/core/src/shell/scripts/set-system-proxy/index.js
+++ b/packages/core/src/shell/scripts/set-system-proxy/index.js
@@ -155,9 +155,11 @@ function getDomesticDomainAllowList () {
}
function getProxyExcludeIpStr (split) {
+ const proxyExcludeIpConfig = config.get().proxy.excludeIpList
+
let excludeIpStr = ''
- for (const ip in config.get().proxy.excludeIpList) {
- if (config.get().proxy.excludeIpList[ip] === true) {
+ for (const ip in proxyExcludeIpConfig) {
+ if (proxyExcludeIpConfig[ip] === true) {
excludeIpStr += ip + split
}
}
@@ -166,12 +168,18 @@ function getProxyExcludeIpStr (split) {
// log.debug('系统代理排除域名(excludeIpStr):', excludeIpStr)
if (config.get().proxy.excludeDomesticDomainAllowList) {
try {
- let domesticDomainAllowList = getDomesticDomainAllowList()
+ const domesticDomainAllowList = getDomesticDomainAllowList()
if (domesticDomainAllowList) {
- domesticDomainAllowList = (`${domesticDomainAllowList}\n`).replaceAll(/[\r\n]+/g, '\n').replaceAll(/[\d*\-.A-Z]*[^\d\n*\-.A-Z][^\n]*\n/gi, '').trim().replaceAll(/\s*\n\s*/g, split)
- if (domesticDomainAllowList) {
- excludeIpStr += domesticDomainAllowList
- log.info('系统代理排除列表拼接国内域名')
+ const domesticDomainList = (`\n${domesticDomainAllowList}`).replaceAll(/[\r\n]+/g, '\n').match(/(?<=\n)(?:[\w\-.*]+|\[[\w:]+\])(?=\n)/g)
+ if (domesticDomainList && domesticDomainList.length > 0) {
+ for (const domesticDomain of domesticDomainList) {
+ if (proxyExcludeIpConfig[domesticDomain] !== false) {
+ excludeIpStr += domesticDomain + split
+ } else {
+ log.info('系统代理排除列表拼接国内域名时,跳过域名,系统代理将继续代理它:', domesticDomain)
+ }
+ }
+ log.info('系统代理排除列表拼接国内域名成功')
} else {
log.info('国内域名为空,不进行系统代理排除列表拼接国内域名')
}
diff --git a/packages/gui/src/view/pages/plugin/overwall.vue b/packages/gui/src/view/pages/plugin/overwall.vue
index 1cf27574eb..283d5aef91 100644
--- a/packages/gui/src/view/pages/plugin/overwall.vue
+++ b/packages/gui/src/view/pages/plugin/overwall.vue
@@ -11,12 +11,12 @@ export default {
servers: undefined,
overwallOptions: [
{
- value: true,
label: '启用',
+ value: 'true',
},
{
- value: false,
label: '禁用',
+ value: 'false',
},
],
}
@@ -49,8 +49,8 @@ export default {
for (const key in targetsMap) {
const value = targetsMap[key]
this.targets.push({
- key,
- value,
+ key: key || '',
+ value: value === true ? 'true' : 'false',
})
}
},
@@ -58,13 +58,13 @@ export default {
this.targets.splice(index, 1)
},
addTarget () {
- this.targets.unshift({ key: '', value: true })
+ this.targets.unshift({ key: '', value: 'true' })
},
saveTarget () {
const map = {}
for (const item of this.targets) {
if (item.key) {
- map[item.key] = item.value
+ map[item.key] = item.value === 'true'
}
}
this.config.plugin.overwall.targets = map
@@ -165,8 +165,8 @@ export default {
不排除
,也可以关闭国内域名白名单
+ 不排除
时,将被代理