From 1b8264778d58145717275a871f7aa15300e698d2 Mon Sep 17 00:00:00 2001 From: Shawn Wen <45581750+KOP-XIAO@users.noreply.github.com> Date: Wed, 7 Jan 2026 16:45:27 +0800 Subject: [PATCH] Update resource-parser.js --- Scripts/resource-parser.js | 44 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index 165f9ae..958fa83 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2025-12-31 15:20⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2026-01-07 13:45⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/ShawnKOP_Parser_Bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -3044,7 +3044,7 @@ function YAMLFix(cnt){ cnt = cnt.replace(/(^|\n)- /g, "$1 - ").replace(/ - /g," - ").replace(/:(?!\s)/g,": ").replace(/\,\"/g,", \"").replace(/: {/g, ": {, ").replace(/, (Host|host|path|mux)/g,", $1") //2022-04-11 remove tls|skip from replace(/, (Host|host|path|mux)/g,", $1") console.log("1st:\n"+cnt) - cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:") + cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:").replace(/, short-id/gi,", short-id") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:") cnt = cnt.replace(/{\s*|\s*}/g,"").replace(/,/g,"\n ") } cnt = cnt.replace(/\n\s*\-\s*\n.*name/g,"\n - name").replace(/\$|\`/g,"").split("proxy-providers:")[0].split("proxy-groups:")[0].replace(/\"(name|type|server|port|cipher|password|uuid|alterId|udp)(\"*)/g,"$1") @@ -3119,6 +3119,8 @@ function Clash2QX(cnt) { node = CH2QX(node) } else if (typecc == "socks5"){ node = CS52QX(node) + } else if (typecc == "vless"){ + node = CVL2QX(node) } node = Pudp0 != 0 ? XUDP(node,Pudp0) : node node = Ptfo0 != 0 ? XTFO(node,Ptfo0) : node @@ -3296,6 +3298,44 @@ function CS52QX(cnt){ return node } +// clash vless type ,2026-01-07 +function CVL2QX(cnt){ + tag = "tag="+cnt.name.replace(/\\U.+?\s{1}/gi," ").replace(/(\"|\')/gi,"") + ipt = cnt.server+":"+cnt.port + pwd = "password=" + cnt.uuid + mtd = "method=none" //cnt.cipher + udp = cnt.udp ? "udp-relay=true" : "udp-relay=false" + tfo = cnt.tfo ? "fast-open=true" : "fast-open=false" + obfs = "" + if (cnt.network == "ws" && cnt.tls) { + obfs = "obfs=wss" + } else if (cnt.network == "ws"){ + obfs = "obfs=ws" + } else if (cnt.tls){ + obfs = "obfs=over-tls" + } + vfl=cnt.flow? "vless-flow=xtls-rprx-vision":"" + const ppbk=getValue(()=>cnt["reality-opts"]["public-key"]) + const psid=getValue(()=>cnt["reality-opts"]["short-id"]) + pbk=ppbk? "reality-base64-pubkey="+ppbk : "" + sid=psid? "reality-hex-shortid="+psid : "" +// console.log(obfs) + const phost = getValue(()=>cnt["ws-opts"]["headers"]["Host"]) + ohost = cnt["ws-headers"]? "obfs-host=" + cnt["ws-headers"]["Host"] : "" + ohost = phost ? "obfs-host="+phost : ohost + //ohost= cnt["ws-opts"]? "obfs-host=" + cnt["ws-opts"]["headers"]["Host"] : ohost + ohost = cnt["servername"]? "obfs-host=" + cnt["servername"] : ohost + cert = cnt["skip-cert-verify"] && cnt.tls ? "tls-verification=false" : "" + //$notify(cert) + if (Pcert0 == 1 && cnt.tls) { + cert = "tls-verification=true" + } else if (Pcert0 != 1 && cnt.tls) { + cert = "tls-verification=false" + } + node = "vless="+[ipt, pwd, mtd, udp, tfo, obfs, ohost, vfl, pbk, sid, cert, tag].filter(Boolean).join(", ") + //console.log(node) + return node +} // UDP/TFO 参数 (强制 surge/quanx 类型转换) function XUDP(cnt,pudp) {