From 21ed03478e8c5f322e736c3dccbe5cc5a05ee6b6 Mon Sep 17 00:00:00 2001 From: Shawn <45581750+KOP-XIAO@users.noreply.github.com> Date: Wed, 13 Jan 2021 21:16:07 +0800 Subject: [PATCH] bug fixed --- Scripts/resource-parser.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index 10dfca3..3dea7d5 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-01-11 20:39⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-01-13 21:39⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -204,10 +204,9 @@ function ResourceParse() { total = Subs2QX(Base64.decode(content0), Pudp0, Ptfo0, Pcert0, PTls13); } else if (type0 == "Subs") { total = Subs2QX(content0, Pudp0, Ptfo0, Pcert0, PTls13); - } else if (type0 == "QuanX" || type0 == "Clash") { + } else if (type0 == "QuanX" || type0 == "Clash" || type0 == "Surge") { total = isQuanX(content0); - } else if (type0 == "Surge") { - total = Surge2QX(content0); + total = Subs2QX(total.join("\n"), Pudp0, Ptfo0, Pcert0, PTls13); } else if (type0 == "sgmodule") { // surge module 模块/含 url-regex 的 rule-set flag = 2 total = SGMD2QX(content0) // 转换 @@ -383,6 +382,7 @@ function Type_Check(subs) { type = "Subs" // QuanX list } else if (subs.indexOf("[Proxy]") != -1) { type = "Surge"; // Surge Profiles + content0 = Surge2QX(content0).join("\n"); } else if ((SurgeK.some(NodeCheck) && !/\[(Proxy|filter_local)\]/.test(subs)) || typeU == "list") { type = "Subs" // Surge proxy list } else if (subs.indexOf("[server_local]") != -1) { @@ -1813,7 +1813,12 @@ function CV2QX(cnt) { ohost = cnt["ws-headers"]? "obfs-host=" + cnt["ws-headers"]["Host"] : "" ouri = cnt["ws-path"]? "obfs-uri="+cnt["ws-path"] : "" cert = cnt["skip-cert-verify"] && cnt.tls ? "tls-verification=false" : "" - if (Pcert0 == 0 && cnt.tls) {cert = "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 = "vmess="+[ipt, pwd, mtd, udp, tfo, obfs, ohost, ouri, cert, tag].filter(Boolean).join(", ") //console.log(node) return node @@ -1826,8 +1831,7 @@ function CT2QX(cnt) { pwd = "password=" + cnt.password otls = "over-tls=true" cert = cnt["skip-cert-verify"] ? "tls-verification=false" : "tls-verification=true" - if (Pcert0 == 0) { - cert = "tls-verification=false" } + cert = Pcert0 == 1 ? "tls-verification=true" : "tls-verification=false" udp = cnt.udp ? "udp-relay=true" : "udp-relay=false" tfo = cnt.tfo ? "fast-open=true" : "fast-open=false" node = "trojan="+[ipt, pwd, otls, cert, udp, tfo, tag].filter(Boolean).join(", ") @@ -1844,7 +1848,11 @@ function CH2QX(cnt){ pwd = cnt.password && typeof(cnt.password) == "string" ? "password=" + cnt.password : "" tls = cnt.tls ? "over-tls=true" : "" cert = cnt["skip-cert-verify"] && cnt.tls ? "tls-verification=false" : "" - if (Pcert0 == 0 && cnt.tls) { cert = "tls-verification=false" } + if (Pcert0 == 1 && cnt.tls) { + cert = "tls-verification=true" + } else if (Pcert0 == 1 && cnt.tls) { + cert = "tls-verification=false" + } node = "http="+[ipt, uname, pwd, tls, cert, tag].filter(Boolean).join(", ") //console.log(node) return node