From ffa459bfa7f65e7e7e0e9c7296b1ce3b820bc2d5 Mon Sep 17 00:00:00 2001 From: cmliu Date: Tue, 27 Jan 2026 20:27:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8F=8D=E4=BB=A3?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=8E=B7=E5=8F=96=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9B=B4=E4=B8=A5=E6=A0=BC=E7=9A=84?= =?UTF-8?q?IP=E5=92=8C=E8=B4=A6=E5=8F=B7=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _worker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_worker.js b/_worker.js index 1aa9996..a145310 100644 --- a/_worker.js +++ b/_worker.js @@ -1688,7 +1688,7 @@ async function 反代参数获取(request) { 启用SOCKS5全局反代 = searchParams.has('globalproxy') || false; // 统一处理反代IP参数 (优先级最高,使用正则一次匹配) - const proxyMatch = pathLower.match(/\/(proxyip[.=]|pyip=|ip=)(.+)/); + const proxyMatch = pathLower.match(/\/(proxyip[.=]|pyip=|ip=)([^/?]+)/); if (searchParams.has('proxyip')) { const 路参IP = searchParams.get('proxyip'); 反代IP = 路参IP.includes(',') ? 路参IP.split(',')[Math.floor(Math.random() * 路参IP.split(',').length)] : 路参IP; @@ -1703,10 +1703,10 @@ async function 反代参数获取(request) { // 处理SOCKS5/HTTP代理参数 let socksMatch; - if ((socksMatch = pathname.match(/\/(socks5?|http):\/?\/?(.+)/i))) { + if ((socksMatch = pathname.match(/\/(socks5?|http):\/?\/?([^/?#]+)/i))) { // 格式: /socks5://... 或 /http://... 启用SOCKS5反代 = socksMatch[1].toLowerCase() === 'http' ? 'http' : 'socks5'; - 我的SOCKS5账号 = socksMatch[2].split('#')[0]; + 我的SOCKS5账号 = socksMatch[2]; 启用SOCKS5全局反代 = true; // 处理Base64编码的用户名密码 @@ -1718,7 +1718,7 @@ async function 反代参数获取(request) { } 我的SOCKS5账号 = `${userPassword}@${我的SOCKS5账号.substring(atIndex + 1)}`; } - } else if ((socksMatch = pathname.match(/\/(g?s5|socks5|g?http)=(.+)/i))) { + } else if ((socksMatch = pathname.match(/\/(g?s5|socks5|g?http)=([^/?#]+)/i))) { // 格式: /socks5=... 或 /s5=... 或 /gs5=... 或 /http=... 或 /ghttp=... const type = socksMatch[1].toLowerCase(); 我的SOCKS5账号 = socksMatch[2];