From 2560ebf0ce8b6545aee56e2a72898c2119eba1d7 Mon Sep 17 00:00:00 2001 From: Shawn <45581750+KOP-XIAO@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:02:12 +0800 Subject: [PATCH] Update resource-parser.js --- Scripts/resource-parser.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index 99d77e3..317ed33 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-04-12 13:35⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-04-18 10:50⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -1539,12 +1539,12 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) { 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|tfo|cert|rename|replace)\=/)[0].split("tag=")[1] : "" - list0[i] = (type == "vmess" || type=="ssr") ? list0[i].split(/#|,|,/)[0] : list0[i] + list0[i] = (type=="ssr") ? list0[i].split(/#|,|,/)[0] : list0[i] // 2023-04-18 remove type == "vmess" || const NodeCheck = (item) => listi.toLowerCase().indexOf(item) != -1; const NodeCheck1 = (item) => listi.toLowerCase().indexOf(item) == 0; try { if (Pdbg) {$notify(i, type, list0[i])} - if (type == "vmess" && (list0[i].indexOf("remark=") == -1 && list0[i].indexOf("remarks=") == -1) && !/(obfs|alterId)\=/.test(list0[i])) { + if (type == "vmess" && (list0[i].indexOf("remark=") == -1 && list0[i].indexOf("remarks=") == -1) && !/(obfs|alterId|type)\=/.test(list0[i])) { var bnode = Base64.decode(list0[i].split("vmess://")[1]) if (bnode.indexOf("over-tls=") == -1) { //v2rayN node = V2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) @@ -1552,7 +1552,7 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) { node = VQ2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) } node = tag0 != "" ? URI_TAG(node, tag0) : node - } else if (type == "vmess" && ( list0[i].indexOf("remark=") != -1 || list0[i].indexOf("remarks=") != -1 || /(obfs|alterId)\=/.test(list0[i]))) { //shadowrocket 类型 + } else if (type == "vmess" && ( list0[i].indexOf("remark=") != -1 || list0[i].indexOf("remarks=") != -1 || /(obfs|alterId|type)\=/.test(list0[i]))) { //shadowrocket 类型 node = VR2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) node = tag0 != "" ? URI_TAG(node, tag0) : node } else if (type == "socks" && list0[i].indexOf("remarks=") != -1) { //shadowrocket socks5 类型 @@ -1765,13 +1765,20 @@ function VQ2QX(subs, Pudp, Ptfo, Pcert0, PTls13) { //Shadowrocket 格式的 vmess URI 转换 function VR2QX(subs, Pudp, Ptfo, Pcert0, PTls13) { var server = String(Base64.decode(subs.replace("vmess://", "").split("?remark")[0].split("&remark")[0].split("?")[0]).trim()).split("\u0000")[0] + if(Pdbg==1) {$notify("Shadowrocket-Vmess-URI","..",subs+"\n\n"+server)} + if (server.indexOf("@")==-1 && subs.indexOf("@")!=-1) { server = subs.replace("vmess://", "").split("?")[0]} var node = "" - var ip = "vmess=" + server.split("@")[1] + ", " + "method=aes-128-gcm, " + "password=" + server.split("@")[0].split(":")[1] + ", " - var tag = /remarks*=/.test(subs)? "tag=" + decodeURIComponent(subs.split(/remarks*=/)[1].split("&")[0]) : "tag="+server.split("@")[1] //部分无节点名的情况 + var ip = "vmess=" + server.split("@")[1] + ", " + "method=aes-128-gcm, " + var pwd = server.split("@")[0].split(":")[1]? "password=" + server.split("@")[0].split(":")[1] + ", " : "password=" + server.split("@")[0]+ ", " + if (subs.indexOf("#")==-1) { + tag = /remarks*=/.test(subs)? "tag=" + decodeURIComponent(subs.split(/remarks*=/)[1].split("&")[0]) : "tag="+server.split("@")[1] //部分无节点名的情况 + } else { + tag = "tag=" + subs.split("#")[1] + } var tfo = subs.indexOf("tfo=1") != -1 ? "fast-open=true, " : "fast-open=false, " var udp = Pudp == 1 ? "udp-relay=false, " : "udp-relay=false, "; var pdrop = 0 - node = ip + tfo + udp + node = ip + pwd+ tfo + udp var obfs = subs.indexOf("obfs=")!=-1 ? subs.split("obfs=")[1].split("&")[0].trim() : "none" if (obfs == "none") { // obfs = subs.indexOf("tls=1") != -1 ? "obfs=over-tls, " : "" //over-tls @@ -2468,6 +2475,7 @@ function get_emoji(emojip, sname) { "🇧🇩": ["孟加拉", "Bengal"], "🇲🇽️": [" MEX", "MX", "墨西哥", "Mexico", "MEXICO"], "🇲🇾": [" MY", "Malaysia","MALAYSIA", "马来西亚", "马来", "馬來", "大马", "大馬", "馬來西亞", "吉隆坡"], + "🇲🇲": ["缅甸"], "🇳🇱": [" NL", "Netherlands", "荷兰", "荷蘭", "尼德蘭", "阿姆斯特丹"], "🇵🇭": [" PH", "Philippines", "菲律宾", "菲律賓"], "🇷🇴": [" RO ", "罗马尼亚", "Rumania"],