From 09dcfba073060bb80ec6473422451425d07dc72f Mon Sep 17 00:00:00 2001 From: cmliu Date: Fri, 21 Nov 2025 21:43:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=97=B6=E7=9A=84=E4=B8=BB=E6=9C=BA=E5=90=8D?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=AD=A3=E7=A1=AE=E7=9A=84=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _worker.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_worker.js b/_worker.js index 2931e4a..0ae3a9a 100644 --- a/_worker.js +++ b/_worker.js @@ -14,6 +14,7 @@ export default { const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/; const envUUID = env.UUID || env.uuid; const userID = (envUUID && uuidRegex.test(envUUID)) ? envUUID.toLowerCase() : [userIDMD5.slice(0, 8), userIDMD5.slice(8, 12), '4' + userIDMD5.slice(13, 16), userIDMD5.slice(16, 20), userIDMD5.slice(20)].join('-'); + const host = env.HOST ? env.HOST.toLowerCase().replace(/^https?:\/\//, '').split('/')[0].split(':')[0] : url.hostname; if (env.PROXYIP) { const proxyIPs = await 整理成数组(env.PROXYIP); 反代IP = proxyIPs[Math.floor(Math.random() * proxyIPs.length)]; @@ -87,11 +88,11 @@ export default { return new Response(JSON.stringify(检测代理响应, null, 2), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } }); } - config_JSON = await 读取config_JSON(env, url.host, userID); + config_JSON = await 读取config_JSON(env, host, userID); if (访问路径 === 'admin/init') {// 重置配置为默认值 try { - config_JSON = await 读取config_JSON(env, url.host, userID, true); + config_JSON = await 读取config_JSON(env, host, userID, true); await 请求日志记录(env, request, 访问IP, 'Init_Config', config_JSON); config_JSON.init = '配置已重置为默认值'; return new Response(JSON.stringify(config_JSON, null, 2), { status: 200, headers: { 'Content-Type': 'application/json;charset=utf-8' } }); @@ -188,7 +189,7 @@ export default { } else if (访问路径 === 'sub') {//处理订阅请求 const 订阅TOKEN = await MD5MD5(url.host + userID); if (url.searchParams.get('token') === 订阅TOKEN) { - config_JSON = await 读取config_JSON(env, url.host, userID); + config_JSON = await 读取config_JSON(env, host, userID); await 请求日志记录(env, request, 访问IP, 'Get_SUB', config_JSON); const ua = UA.toLowerCase(); const expire = 4102329600;//2099-12-31 到期时间