diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index a23b894..a259cfb 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-03-27 00:19⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-03-28 11:39⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -566,6 +566,12 @@ function getnode_emoji(item,ind){ } } +// 用于单条 URI 的 tag 参数, 直接指定节点名 +function URI_TAG(cnt0,tag0) { + cnt0 = cnt0.split("tag=")[0] + "tag=" + tag0 + return cnt0 +} + // 用于某些奇葩用户不使用 raw 链接的问题 function rawtest(cnt) { var Preg0 = RegExp(".*js-file-line\".*?\<\/td\>", "i") @@ -958,6 +964,8 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert, Ptls13) { if (list0[i].trim().length > 3 && !/\;|\/|\#/.test(list0[i][0])) { var type = list0[i].split("://")[0].trim() var listi = list0[i].replace(/ /g, "") + var tag0 = list0[i].indexOf("tag=")!=-1 ? list0[i].split(/\&*(emoji|udp|tf0|cert|rename|replace)\=/)[0].split("tag=")[1] : "" + list0[i] = (type == "vmess" || type=="ssr") ? list0[i].split("#")[0] : list0[i] const NodeCheck = (item) => listi.toLowerCase().indexOf(item) != -1; try { if (type == "vmess" && list0[i].indexOf("remarks=") == -1) { @@ -967,23 +975,30 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert, Ptls13) { } else { //quantumult 类型 node = VQ2QX(list0[i], Pudp, Ptfo, Pcert, Ptls13) } + node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "vmess" && list0[i].indexOf("remarks=") != -1) { //shadowrocket 类型 node = VR2QX(list0[i], Pudp, Ptfo, Pcert, Ptls13) + node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "ssr") { node = SSR2QX(list0[i], Pudp, Ptfo) + node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "ss") { node = SS2QX(list0[i], Pudp, Ptfo) + node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "ssd") { node = SSD2QX(list0[i], Pudp, Ptfo) } else if (type == "trojan") { node = TJ2QX(list0[i], Pudp, Ptfo, Pcert, Ptls13) + node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "https" && list0[i].indexOf(",") == -1) { if (listi.indexOf("@") != -1) { node = HPS2QX(list0[i], Ptfo, Pcert, Ptls13) + node = tag0 != "" ? URI_TAG(node, tag0) : node } else { var listh = Base64.decode(listi.split("https://")[1].split("#")[0]) listh = "https://" + listh + "#" + listi.split("https://")[1].split("#")[1] node = HPS2QX(listh, Ptfo, Pcert, Ptls13) + node = tag0 != "" ? URI_TAG(node, tag0) : node } } else if (QuanXK.some(NodeCheck)) { node = QX_TLS(isQuanX(list0[i])[0])