Browse Source

fix: 修复关闭pac无效的bug

pull/192/head
18603046467 3 years ago
parent
commit
9c7fb89265
  1. 2
      packages/core/src/config/index.js
  2. 5
      packages/mitmproxy/src/lib/proxy/middleware/overwall.js

2
packages/core/src/config/index.js

@ -163,7 +163,7 @@ module.exports = {
'www.googleapis.com': { '.*': { abort: false, desc: '设置abort:true可以快速失败,节省时间' } }, 'www.googleapis.com': { '.*': { abort: false, desc: '设置abort:true可以快速失败,节省时间' } },
'lh*.googleusercontent.com': { '.*': { abort: false, desc: '设置abort:true可以快速失败,节省时间' } }, 'lh*.googleusercontent.com': { '.*': { abort: false, desc: '设置abort:true可以快速失败,节省时间' } },
// mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-win32-x64.tar.gz // mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-win32-x64.tar.gz
'*.s3.amazonaws.com': { '*.s3.1amazonaws1.com': {
'/sqlite3/.*': { '/sqlite3/.*': {
redirect: 'npm.taobao.org/mirrors' redirect: 'npm.taobao.org/mirrors'
} }

5
packages/mitmproxy/src/lib/proxy/middleware/overwall.js

@ -8,6 +8,9 @@ function matched (hostname, regexpMap) {
if (ret1) { if (ret1) {
return true return true
} }
if (pacClient == null) {
return false
}
const ret = pacClient.FindProxyForURL('https://' + hostname, hostname) const ret = pacClient.FindProxyForURL('https://' + hostname, hostname)
if (ret && ret.indexOf('PROXY ') === 0) { if (ret && ret.indexOf('PROXY ') === 0) {
return true return true
@ -19,7 +22,7 @@ module.exports = function createOverWallIntercept (overWallConfig) {
if (!overWallConfig || overWallConfig.enabled !== true) { if (!overWallConfig || overWallConfig.enabled !== true) {
return null return null
} }
if (overWallConfig.pac) { if (overWallConfig.pac && overWallConfig.pac.enabled) {
// 初始化pac // 初始化pac
pacClient = pac.createPacClient(overWallConfig.pac.pacFileAbsolutePath) pacClient = pac.createPacClient(overWallConfig.pac.pacFileAbsolutePath)
} }

Loading…
Cancel
Save