Skip to content

Commit bd3271f

Browse files
authored
Fetch CUSTOM_PREFIX from worker env variables.
1 parent 92fc6cc commit bd3271f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

_worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const Version = '2026-08-11 14:45:22';
22
let config_JSON, 缓存SOCKS5白名单 = null, 调试日志打印 = false;
33
let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com'];
4+
let CUSTOM_PREFIX = '';
45
const Pages静态页面 = 'https://edt-pages.github.io';
56
///////////////////////////////////////////////////////全局常量和工具函数///////////////////////////////////////////////
67
const WS早期数据最大字节 = 8 * 1024, WS早期数据最大头长度 = Math.ceil(WS早期数据最大字节 * 4 / 3) + 4;
@@ -35,6 +36,7 @@ export default {
3536
const hosts = env.HOST ? (await 整理成数组(env.HOST)).map(h => h.toLowerCase().replace(/^https?:\/\//, '').split('/')[0].split(':')[0]) : [url.hostname];
3637
const host = hosts[0];
3738
const 访问路径 = url.pathname.slice(1).toLowerCase();
39+
CUSTOM_PREFIX = env. PREFIX || '';
3840
调试日志打印 = ['1', 'true'].includes(env.DEBUG) || 调试日志打印;
3941
预加载竞速拨号 = ['1', 'true'].includes(env.PRELOAD_RACE_DIAL) || 预加载竞速拨号;
4042
反代并发拨号数 = Math.max(1, Number(env.PROXY_CONCURRENT_DIAL) || 反代并发拨号数);
@@ -5871,7 +5873,7 @@ async function 生成随机IP(request, count = 16, 指定端口 = -1) {
58715873
cf: 'CF官方优选',
58725874
};
58735875
const cidr_url = 运营商文件标识 === 'cf' ? `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR.txt` : `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR/${运营商文件标识}.txt`;
5874-
const cfname = 运营商名称映射[运营商文件标识] || 'CF官方优选';
5876+
const cfname = CUSTOM_PREFIX || 运营商名称映射[运营商文件标识] || 'CF官方优选';
58755877
const cfport = [443, 2053, 2083, 2087, 2096, 8443];
58765878
let cidrList = [];
58775879
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'] }

0 commit comments

Comments
 (0)