From 576b5cf3baaab10111a6abf9e39888dc0071a3fb Mon Sep 17 00:00:00 2001 From: CMLiussss <24787744+cmliu@users.noreply.github.com> Date: Sun, 11 Feb 2024 02:11:20 +0800 Subject: [PATCH] Update _worker.js --- _worker.js | 100 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 29 deletions(-) diff --git a/_worker.js b/_worker.js index b57a79e..9cff2cb 100644 --- a/_worker.js +++ b/_worker.js @@ -9,7 +9,7 @@ let userID = '90cd4a77-141a-43c9-991b-08263cfe9c10'; let proxyIP = '';// 小白勿动,该地址并不影响你的网速,这是给CF代理使用的。'cdn.xn--b6gac.eu.org', 'cdn-all.xn--b6gac.eu.org', 'edgetunnel.anycast.eu.org' //let sub = '';// 留空则显示原版内容 -let sub = 'sub.cmliucdn.tk';// 内置优选订阅生成器,可自行搭建 https://github.com/cmliu/WorkerVless2sub +let sub = 'sub.cmliussss.workers.dev';// 内置优选订阅生成器,可自行搭建 https://github.com/cmliu/WorkerVless2sub let subconverter = 'api.v1.mk';// clash订阅转换后端,目前使用肥羊的订阅转换功能。支持自建psub 可自行搭建https://github.com/bulianglin/psub let subconfig = "https://raw.githubusercontent.com/cmliu/edgetunnel/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini"; //订阅配置文件 // The user name and password do not contain special characters @@ -784,35 +784,77 @@ function socks5AddressParser(address) { async function getVLESSConfig(userID, hostName, sub, userAgent, proxyIP) { if (!proxyIP || proxyIP === '') RproxyIP = "true"; // 如果sub为空,则显示原始内容 - if (!sub) { - const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; + if (!sub || sub === '') { + const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; - return ` - ################################################################ - v2ray - --------------------------------------------------------------- - ${vlessMain} - --------------------------------------------------------------- - ################################################################ - clash-meta - --------------------------------------------------------------- - - type: vless - name: ${hostName} - server: ${hostName} - port: 443 - uuid: ${userID} - network: ws - tls: true - udp: false - sni: ${hostName} - client-fingerprint: chrome - ws-opts: - path: "/?ed=2048" - headers: - host: ${hostName} - --------------------------------------------------------------- - ################################################################ - `; + return ` + ################################################################ + v2ray + --------------------------------------------------------------- + ${vlessMain} + --------------------------------------------------------------- + ################################################################ + clash-meta + --------------------------------------------------------------- + - type: vless + name: ${hostName} + server: ${hostName} + port: 443 + uuid: ${userID} + network: ws + tls: true + udp: false + sni: ${hostName} + client-fingerprint: chrome + ws-opts: + path: "/?ed=2048" + headers: + host: ${hostName} + --------------------------------------------------------------- + ################################################################ + `; + } else if (sub && userAgent.includes('mozilla')) { + const vlessMain = `vless://${userID}@${hostName}:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`; + + return ` + ################################################################ + Subscribe / sub + 响应式订阅链接, 支持 Base64、clash-meta、sing-box 订阅格式, 您的订阅内容由 ${sub} 提供维护支持. + --------------------------------------------------------------- + https://${hostName}/${userID} + --------------------------------------------------------------- + ################################################################ + v2ray + --------------------------------------------------------------- + ${vlessMain} + --------------------------------------------------------------- + ################################################################ + clash-meta + --------------------------------------------------------------- + - type: vless + name: ${hostName} + server: ${hostName} + port: 443 + uuid: ${userID} + network: ws + tls: true + udp: false + sni: ${hostName} + client-fingerprint: chrome + ws-opts: + path: "/?ed=2048" + headers: + host: ${hostName} + --------------------------------------------------------------- + ################################################################ + telegram 交流群 技术大佬~在线发牌! + https://t.me/CMLiussss + --------------------------------------------------------------- + github 项目地址 Star!Star!Star!!! + https://github.com/cmliu/edgetunnel + --------------------------------------------------------------- + ################################################################ + `; } else if (sub && userAgent.includes('clash')) { // 如果sub不为空且UA为clash,则发起特定请求 if (typeof fetch === 'function') {