diff --git a/package.json b/package.json index f567093942..2e0e4daa78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blhxfy", - "version": "0.6.2", + "version": "0.6.3", "description": "碧蓝幻想微风机翻团", "main": "main.js", "scripts": { diff --git a/proxy/pac.js b/proxy/pac.js index 05158d428f..c9e8e4bba1 100644 --- a/proxy/pac.js +++ b/proxy/pac.js @@ -1,9 +1,21 @@ const ip = require('ip') const someHostList = [ - 'www.google.com', + '*.google.com', + '*.twitter.com', + 'twitter.com', 'csp.withgoogle.com', - 'www.gstatic.com' + '*.google-analytics.com', + 'www.gstatic.com', + 'dmm.com', + '*.dmm.com' +] + +const gameExtraHostList = [ + 'cdn-connect.mobage.jp', + 'cdn-widget.mobage.jp', + 'connect.mobage.jp', + 'platform.twitter.com' ] const localIp = ip.address() @@ -18,6 +30,9 @@ module.exports = function ({ apiHostNames, staticHostNames, staticServer, frontA const condition3 = someHostList.map(name => { return `shExpMatch(host, "${name}")` }).join('||') + const condition4 = gameExtraHostList.map(name => { + return `shExpMatch(host, "${name}")` + }).join('||') const getScript = (condition) => (conditionEx) => (result) => { const template = ` @@ -25,13 +40,13 @@ module.exports = function ({ apiHostNames, staticHostNames, staticServer, frontA if (isInNet(dnsResolve(host),"127.0.0.1","255.255.255.0")) { return "DIRECT"; } - if (shExpMatch(host, "${localIp}")) { + if (shExpMatch(host, "${localIp}") || isPlainHostName(host)) { return "DIRECT"; } if (${condition} || ${conditionEx}) { return "PROXY ${localIp}:${port};DIRECT"; } - if (${frontAgent} && (${condition2})) { + if (${frontAgent} && (${condition2} || ${condition4} || ${condition3})) { return "PROXY ${localIp}:${frontAgentPort}; PROXY 127.0.0.1:${frontAgentPort}; DIRECT" } if (!${frontAgent} && (${condition3})) { @@ -50,7 +65,7 @@ module.exports = function ({ apiHostNames, staticHostNames, staticServer, frontA script = script('false') } if (frontAgent) { - script = script(`PROXY ${localIp}:${frontAgentPort}; PROXY 127.0.0.1:${frontAgentPort}; DIRECT`) + script = script(`DIRECT; PROXY ${localIp}:${frontAgentPort}; PROXY 127.0.0.1:${frontAgentPort}`) } else { script = script(`DIRECT; PROXY ${localIp}:${frontAgentPort}; PROXY 127.0.0.1:${frontAgentPort}`) }