Skip to content

Commit d96bbaf

Browse files
committed
fix: 优化订阅生成逻辑,确保路径处理一致性
1 parent dd11c2a commit d96bbaf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

_worker.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,13 @@ export default {
261261
return null;
262262
}
263263
const 节点HOST = 随机替换通配符(host);
264-
return `${协议类型}://${config_JSON.UUID}@${节点地址}:${节点端口}?security=tls&type=${config_JSON.传输协议}&host=${节点HOST}&sni=${节点HOST}&path=${encodeURIComponent((随机路径() + 节点路径).replace('/?', '?')) + TLS分片参数}&encryption=none${config_JSON.跳过证书验证 ? '&allowInsecure=1' : ''}#${encodeURIComponent(节点备注)}`;
264+
return `${协议类型}://${config_JSON.UUID}@${节点地址}:${节点端口}?security=tls&type=${config_JSON.传输协议}&host=${节点HOST}&sni=${节点HOST}&path=${encodeURIComponent(config_JSON.随机路径 ? 随机路径() + 节点路径 : 节点路径) + TLS分片参数}&encryption=none${config_JSON.跳过证书验证 ? '&allowInsecure=1' : ''}#${encodeURIComponent(节点备注)}`;
265265
}).filter(item => item !== null).join('\n');
266266
订阅内容 = btoa(其他节点LINK + 订阅内容);
267267
} else { // 优选订阅生成器
268268
let 优选订阅生成器HOST = url.searchParams.get('sub') || config_JSON.优选订阅生成.SUB;
269269
优选订阅生成器HOST = 优选订阅生成器HOST && !/^https?:\/\//i.test(优选订阅生成器HOST) ? `https://${优选订阅生成器HOST}` : 优选订阅生成器HOST;
270-
const 优选订阅生成器URL = `${优选订阅生成器HOST}/sub?host=example.com&${协议类型 === ('v' + 'le' + 'ss') ? 'uuid' : 'pw'}=00000000-0000-4000-0000-000000000000&path=${encodeURIComponent((随机路径() + 节点路径).replace('/?', '?')) + TLS分片参数}&type=${config_JSON.传输协议}`;
270+
const 优选订阅生成器URL = `${优选订阅生成器HOST}/sub?host=example.com&${协议类型 === ('v' + 'le' + 'ss') ? 'uuid' : 'pw'}=00000000-0000-4000-0000-000000000000&path=${encodeURIComponent(config_JSON.随机路径 ? 随机路径() + 节点路径 : 节点路径) + TLS分片参数}&type=${config_JSON.传输协议}`;
271271
try {
272272
const response = await fetch(优选订阅生成器URL, { headers: { 'User-Agent': 'v2rayN/edge' + 'tunnel (https://github.com/cmliu/edge' + 'tunnel)' } });
273273
if (response.ok) 订阅内容 = btoa(其他节点LINK + atob(await response.text()));
@@ -847,6 +847,7 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
847847
跳过证书验证: true,
848848
启用0RTT: true,
849849
TLS分片: null,
850+
随机路径: false,
850851
优选订阅生成: {
851852
local: true, // true: 基于本地的优选地址 false: 优选订阅生成器
852853
本地IP库: {

0 commit comments

Comments
 (0)