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 { - - {{ item.label }} + + {{ item2.label }} diff --git a/packages/gui/src/view/pages/proxy.vue b/packages/gui/src/view/pages/proxy.vue index fe06202df4..bc38be9297 100644 --- a/packages/gui/src/view/pages/proxy.vue +++ b/packages/gui/src/view/pages/proxy.vue @@ -9,6 +9,16 @@ export default { key: 'proxy', loopbackVisible: false, excludeIpList: [], + excludeIpOptions: [ + { + label: '排除', + value: 'true', + }, + { + label: '不排除', + value: 'false', + }, + ], } }, async created () { @@ -43,13 +53,13 @@ export default { for (const key in this.config.proxy.excludeIpList) { const value = this.config.proxy.excludeIpList[key] this.excludeIpList.push({ - key, - value, + key: key || '', + value: value === true ? 'true' : 'false', }) } }, addExcludeIp () { - this.excludeIpList.unshift({ key: '', value: true }) + this.excludeIpList.unshift({ key: '', value: 'true' }) }, delExcludeIp (item, index) { this.excludeIpList.splice(index, 1) @@ -58,7 +68,7 @@ export default { const excludeIpList = {} for (const item of this.excludeIpList) { if (item.key) { - excludeIpList[item.key] = item.value + excludeIpList[item.key] = item.value === 'true' } } this.config.proxy.excludeIpList = excludeIpList @@ -122,6 +132,9 @@ export default { 是否排除国内域名白名单 +
+ 国内域名白名单内收录了国内可直接访问的域名,这些域名将不被代理
当里面某些域名你希望代理时,你可以配置这些域名为不排除,也可以关闭国内域名白名单 +
@@ -142,15 +155,22 @@ export default { - 访问的域名或IP符合下列配置时,将跳过系统代理 + 国内域名不包含的域名,可以在此处定义;配置为 不排除时,将被代理 - - + + + + + + + {{ item2.label }} + +