diff --git a/_worker.js b/_worker.js index 551bdc740a..778befbf25 100644 --- a/_worker.js +++ b/_worker.js @@ -1,6 +1,7 @@ const Version = '2026-08-11 14:45:22'; let config_JSON, 缓存SOCKS5白名单 = null, 调试日志打印 = false; let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com']; +let CUSTOM_PREFIX = ''; const Pages静态页面 = 'https://edt-pages.github.io'; ///////////////////////////////////////////////////////全局常量和工具函数/////////////////////////////////////////////// const WS早期数据最大字节 = 8 * 1024, WS早期数据最大头长度 = Math.ceil(WS早期数据最大字节 * 4 / 3) + 4; @@ -35,6 +36,7 @@ export default { const hosts = env.HOST ? (await 整理成数组(env.HOST)).map(h => h.toLowerCase().replace(/^https?:\/\//, '').split('/')[0].split(':')[0]) : [url.hostname]; const host = hosts[0]; const 访问路径 = url.pathname.slice(1).toLowerCase(); + CUSTOM_PREFIX = env. PREFIX || ''; 调试日志打印 = ['1', 'true'].includes(env.DEBUG) || 调试日志打印; 预加载竞速拨号 = ['1', 'true'].includes(env.PRELOAD_RACE_DIAL) || 预加载竞速拨号; 反代并发拨号数 = Math.max(1, Number(env.PROXY_CONCURRENT_DIAL) || 反代并发拨号数); @@ -5871,7 +5873,7 @@ async function 生成随机IP(request, count = 16, 指定端口 = -1) { cf: 'CF官方优选', }; const cidr_url = 运营商文件标识 === 'cf' ? `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR.txt` : `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR/${运营商文件标识}.txt`; - const cfname = 运营商名称映射[运营商文件标识] || 'CF官方优选'; + const cfname = CUSTOM_PREFIX || 运营商名称映射[运营商文件标识] || 'CF官方优选'; const cfport = [443, 2053, 2083, 2087, 2096, 8443]; let cidrList = []; try { const res = await fetch(cidr_url); cidrList = res.ok ? await 整理成数组(await res.text()) : ['104.16.0.0/13'] } catch { cidrList = ['104.16.0.0/13'] }