Merge pull request #838 from cmliu/beta2.0

Beta2.0
This commit is contained in:
CMLiussss
2025-11-19 13:37:41 +08:00
committed by GitHub

View File

@@ -27,7 +27,9 @@ export default {
const 访问路径 = url.pathname.slice(1).toLowerCase();
const 区分大小写访问路径 = url.pathname.slice(1);
if (访问路径 === 加密秘钥 && 加密秘钥 !== '勿动此默认密钥有需求请自行通过添加变量KEY进行修改') {//快速订阅
return new Response('重定向中...', { status: 302, headers: { 'Location': `/sub?token=${await MD5MD5(url.host + userID)}` } });
const params = new URLSearchParams(url.search);
params.set('token', await MD5MD5(url.host + userID));
return new Response('重定向中...', { status: 302, headers: { 'Location': `/sub?${params.toString()}` } });
} else if (访问路径 === 'login') {//处理登录页面和登录请求
const cookies = request.headers.get('Cookie') || '';
const authCookie = cookies.split(';').find(c => c.trim().startsWith('auth='))?.split('=')[1];
@@ -1074,10 +1076,12 @@ async function 反代参数获取(request) {
// 统一处理反代IP参数 (优先级最高,使用正则一次匹配)
const proxyMatch = pathLower.match(/\/(proxyip[.=]|pyip=|ip=)(.+)/);
if (searchParams.has('proxyip')) {
反代IP = searchParams.get('proxyip');
const 路参IP = searchParams.get('proxyip');
反代IP = 路参IP.includes(',') ? 路参IP.split(',')[Math.floor(Math.random() * 路参IP.split(',').length)] : 路参IP;
return;
} else if (proxyMatch) {
反代IP = proxyMatch[1] === 'proxyip.' ? `proxyip.${proxyMatch[2]}` : proxyMatch[2];
const 路参IP = proxyMatch[1] === 'proxyip.' ? `proxyip.${proxyMatch[2]}` : proxyMatch[2];
反代IP = 路参IP.includes(',') ? 路参IP.split(',')[Math.floor(Math.random() * 路参IP.split(',').length)] : 路参IP;
return;
}