Skip to content

Commit 02ae9d8

Browse files
authored
Merge pull request cmliu#937 from cmliu/beta2.0
fix: 更新读取config_JSON函数,修复PATH参数处理逻辑以避免路径错误
2 parents 17a03d5 + a6dc025 commit 02ae9d8

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

_worker.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
14481448

14491449
const { SOCKS5, PROXYIP } = config_JSON.反代;
14501450
const PATH反代参数 = SOCKS5.启用 ? `${SOCKS5.启用}${SOCKS5.全局 ? '://' : '='}${SOCKS5.账号}` : (PROXYIP === 'auto' ? '' : `proxyip=${PROXYIP}`);
1451+
config_JSON.PATH = config_JSON.PATH.replace(PATH反代参数, '').replace('//', '/');
14511452
const normalizedPath = config_JSON.PATH === '/' ? '' : config_JSON.PATH.replace(/\/+(?=\?|$)/, '').replace(/\/+$/, '');
14521453
const [路径部分, ...查询数组] = normalizedPath.split('?');
14531454
const 查询部分 = 查询数组.length ? '?' + 查询数组.join('?') : '';
@@ -1513,11 +1514,11 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
15131514

15141515
async function 生成随机IP(request, count = 16, 指定端口 = -1) {
15151516
const ISP配置 = {
1516-
'9808': { file: 'cmcc', name: 'CF移动优选' },
1517-
'4837': { file: 'cu', name: 'CF联通优选' },
1518-
'17623': { file: 'cu', name: 'CF联通优选' },
1519-
'17816': { file: 'cu', name: 'CF联通优选' },
1520-
'4134': { file: 'ct', name: 'CF电信优选' },
1517+
'9808': { file: 'cmcc', name: 'CF移动优选' },
1518+
'4837': { file: 'cu', name: 'CF联通优选' },
1519+
'17623': { file: 'cu', name: 'CF联通优选' },
1520+
'17816': { file: 'cu', name: 'CF联通优选' },
1521+
'4134': { file: 'ct', name: 'CF电信优选' },
15211522
};
15221523
const asn = request.cf.asn, isp = ISP配置[asn];
15231524
const cidr_url = isp ? `https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR/${isp.file}.txt` : 'https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR.txt';

0 commit comments

Comments
 (0)