Update resource-parser.js

This commit is contained in:
Shawn
2023-03-16 11:15:04 +08:00
parent dc4592aba4
commit 8b2354cc69

View File

@@ -1,5 +1,5 @@
/** /**
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-03-13 16:00⟧ ☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-03-15 13:00⟧
---------------------------------------------------------- ----------------------------------------------------------
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot 🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
@@ -615,6 +615,9 @@ function Type_Check(subs) {
typec = "filter-list" typec = "filter-list"
type = (typeQ == "unsupported" || typeQ =="filter")? "Rule":"wrong-field"; type = (typeQ == "unsupported" || typeQ =="filter")? "Rule":"wrong-field";
content0 = content0.split("\n").map(rule_list_handle).join("\n") content0 = content0.split("\n").map(rule_list_handle).join("\n")
} else if (subi.indexOf("sub://") == 0) { // sub:// 类型
typec = "sub-http"
type = "sub-http"
} else if (typeQ == "filter" && subs.indexOf("payload:")!=-1) { // clash-provider 类型? } else if (typeQ == "filter" && subs.indexOf("payload:")!=-1) { // clash-provider 类型?
typec = "Clash-Provider" typec = "Clash-Provider"
type = (typeQ == "unsupported" || typeQ =="filter")? "Rule":"wrong-field"; type = (typeQ == "unsupported" || typeQ =="filter")? "Rule":"wrong-field";
@@ -652,9 +655,6 @@ function Type_Check(subs) {
} else if (QXProfile.every(ProfileCheck)) { } else if (QXProfile.every(ProfileCheck)) {
typec = "profile" typec = "profile"
type = "profile" //默认配置类型 type = "profile" //默认配置类型
} else if (subi.indexOf("sub://") == 0) { // sub:// 类型
typec = "sub-http"
type = "sub-http"
}else if (/\.js/.test(link0)) { // xjb添加js脚本的行为 }else if (/\.js/.test(link0)) { // xjb添加js脚本的行为
$notify("⚠️ 你导入的链接内容为 JS 脚本","🚥 脚本内未有重写规则,无法解析使用", " 请⚠️不要⚠️跑来解析器🤖️反馈 \n"+link0) $notify("⚠️ 你导入的链接内容为 JS 脚本","🚥 脚本内未有重写规则,无法解析使用", " 请⚠️不要⚠️跑来解析器🤖️反馈 \n"+link0)
type = "JS-0" type = "JS-0"
@@ -1509,7 +1509,7 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
const NodeCheck1 = (item) => listi.toLowerCase().indexOf(item) == 0; const NodeCheck1 = (item) => listi.toLowerCase().indexOf(item) == 0;
try { try {
if (Pdbg) {$notify(i, type, list0[i])} if (Pdbg) {$notify(i, type, list0[i])}
if (type == "vmess" && (list0[i].indexOf("remark=") == -1 && list0[i].indexOf("remarks=") == -1)) { if (type == "vmess" && (list0[i].indexOf("remark=") == -1 && list0[i].indexOf("remarks=") == -1) && !/(obfs|alterId)\=/.test(list0[i])) {
var bnode = Base64.decode(list0[i].split("vmess://")[1]) var bnode = Base64.decode(list0[i].split("vmess://")[1])
if (bnode.indexOf("over-tls=") == -1) { //v2rayN if (bnode.indexOf("over-tls=") == -1) { //v2rayN
node = V2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) node = V2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13)
@@ -1517,7 +1517,7 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
node = VQ2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) node = VQ2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13)
} }
node = tag0 != "" ? URI_TAG(node, tag0) : node node = tag0 != "" ? URI_TAG(node, tag0) : node
} else if (type == "vmess" && ( list0[i].indexOf("remark=") != -1 || list0[i].indexOf("remarks=") != -1)) { //shadowrocket 类型 } else if (type == "vmess" && ( list0[i].indexOf("remark=") != -1 || list0[i].indexOf("remarks=") != -1 || /(obfs|alterId)\=/.test(list0[i]))) { //shadowrocket 类型
node = VR2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13) node = VR2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13)
node = tag0 != "" ? URI_TAG(node, tag0) : node node = tag0 != "" ? URI_TAG(node, tag0) : node
} else if (type == "socks" && list0[i].indexOf("remarks=") != -1) { //shadowrocket socks5 类型 } else if (type == "socks" && list0[i].indexOf("remarks=") != -1) { //shadowrocket socks5 类型
@@ -1731,7 +1731,7 @@ 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] var server = String(Base64.decode(subs.replace("vmess://", "").split("?remark")[0].split("&remark")[0].split("?")[0]).trim()).split("\u0000")[0]
var node = "" var node = ""
var ip = "vmess=" + server.split("@")[1] + ", " + "method=aes-128-gcm, " + "password=" + server.split("@")[0].split(":")[1] + ", " var ip = "vmess=" + server.split("@")[1] + ", " + "method=aes-128-gcm, " + "password=" + server.split("@")[0].split(":")[1] + ", "
var tag = "tag=" + decodeURIComponent(subs.split(/remarks*=/)[1].split("&")[0]) var tag = /remarks*=/.test(subs)? "tag=" + decodeURIComponent(subs.split(/remarks*=/)[1].split("&")[0]) : "tag="+server.split("@")[1] //部分无节点名的情况
var tfo = subs.indexOf("tfo=1") != -1 ? "fast-open=true, " : "fast-open=false, " var tfo = subs.indexOf("tfo=1") != -1 ? "fast-open=true, " : "fast-open=false, "
var udp = Pudp == 1 ? "udp-relay=false, " : "udp-relay=false, "; var udp = Pudp == 1 ? "udp-relay=false, " : "udp-relay=false, ";
var pdrop = 0 var pdrop = 0