Update resource-parser.js

This commit is contained in:
Shawn Wen
2025-12-30 15:56:02 +08:00
parent 201ec5bc58
commit 57d9b2f03e

View File

@@ -1,5 +1,5 @@
/**
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2025-12-30 12:55
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2025-12-30 15:30
----------------------------------------------------------
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/ShawnKOP_Parser_Bot
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
@@ -581,10 +581,10 @@ function Type_Check(subs) {
var type = "unknown"
var RuleK = ["host,", "-suffix,", "domain,", "-keyword,", "ip-cidr,", "ip-cidr6,", "geoip,", "user-agent,", "ip6-cidr,", "ip-asn"];
var DomainK = ["domain-set,"]
var QuanXK = ["shadowsocks=", "trojan=", "vmess=", "http=", "socks5="];
var QuanXK = ["shadowsocks=", "trojan=", "vmess=", "http=", "socks5=", "vless="];
var SurgeK = ["=ss,", "=vmess,", "=trojan,", "=http,", "=custom,", "=https,", "=shadowsocks", "=shadowsocksr", "=sock5", "=sock5-tls"];
var ClashK = ["proxies:"]
var SubK = ["dm1lc3M", "c3NyOi8v", "CnNzOi8", "dHJvamFu", "c3M6Ly", "c3NkOi8v", "c2hhZG93", "aHR0cDovLw", "aHR0cHM6L", "CnRyb2phbjo", "aHR0cD0", "aHR0cCA","U1RBVFVT"];
var SubK = ["dm1lc3M", "c3NyOi8v", "CnNzOi8", "dHJvamFu", "c3M6Ly", "c3NkOi8v", "c2hhZG93", "aHR0cDovLw", "aHR0cHM6L", "CnRyb2phbjo", "aHR0cD0", "aHR0cCA","U1RBVFVT","dmxlc3M6"];
var RewriteK = [" url 302", " url 307", " url reject", " url script", " url req", " url res", " url echo", " url-and-header 302", " url-and-header 307", " url-and-header reject", " url-and-header script", " url-and-header req", " url-and-header res", " url-and-header echo", " url jsonjq"] // quantumult X 类型 rewrite
var SubK2 = ["ss://", "vmess://", "ssr://", "trojan://", "ssd://", "\nhttps://", "\nhttp://","socks://","ssocks://","vless://"];
var ModuleK = ["[Script]", "[Rule]", "[URL Rewrite]", "[Map Local]", "\nhttp-r", "script-path"]
@@ -1563,7 +1563,7 @@ function ReplaceReg(cnt, para) {
function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
if (Pdbg) {$notify("subs", "node", subs)}
var list0 = subs.split("\n");
var QuanXK = ["shadowsocks=", "trojan=", "vmess=", "http=","socks5="];
var QuanXK = ["shadowsocks=", "trojan=", "vmess=", "http=","socks5=", "vless="];
var SurgeK = ["=ss,", "=vmess,", "=trojan,", "=http,", "=https,", "=custom,", "=socks5", "=socks5-tls"];
var LoonK = ["=shadowsocks", "=shadowsocksr", "=vless"]
var QXlist = [];
@@ -1623,11 +1623,11 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
$notify("⚠️ 你的 Quantumult X 版本暂未支持 Vless 节点","请 ⚠️不要⚠️ 跑来 解析器🤖️ 反馈",list0[i])
} else if (type == "vless" ) { // version 150 support vless
node=VL2QX(list0[i], Pudp, Ptfo, Pcert0, PTls13)
} else if (QuanXK.some(NodeCheck1)) {
} else if (QuanXK.some(NodeCheck1)) { // QuanX type
node = QX_TLS(isQuanX(list0[i])[0], Pcert0, PTls13)
} else if (SurgeK.some(NodeCheck)) {
} else if (SurgeK.some(NodeCheck)) { // Surge type
node = QX_TLS(Surge2QX(list0[i])[0], Pcert0, PTls13)
} else if (LoonK.some(NodeCheck)) {
} else if (LoonK.some(NodeCheck)) { // Loon type
node = Loon2QX(list0[i])
}
} catch (e) {
@@ -2107,7 +2107,7 @@ function VL2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
mtd= "method=none"
obfs=""
thost=""
if(cnt.indexOf("remarks=")==-1 && cnt.indexOf("@")!=-1) { // normal URI
if((cnt.indexOf("remarks=")==-1 && cnt.indexOf("remark=")==-1) && cnt.indexOf("@")!=-1) { // normal URI
typeU = "URI"
ip = cnt.split("@")[1].split("encry")[0].split("?")[0];
pwd = cnt.split("@")[0]? "password=" + cnt.split("@")[0]:"";
@@ -2117,12 +2117,13 @@ function VL2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
tag = cnt.indexOf("#") != -1 ? "tag=" + decodeURIComponent(cnt.split("#").slice(-1)[0]) : "tag= [vless]" + ip
} else { // shadowrocket style
typeU = "SR-URI"
tag = cnt.indexOf("remarks=") != -1 ? "tag=" + decodeURIComponent(cnt.split("remarks=")[1].split("&")[0]) : "tag= [vless]" + ip
b64part = Base64.decode(cnt.split("?")[0])
ip = b64part.split("@")[1]
pwd = "password=" + b64part.split("@")[0].split(":")[1]
tag = cnt.indexOf("remarks=") != -1 ? "tag=" + decodeURIComponent(cnt.split("remarks=")[1].split("&")[0]) : "tag= [vless]" + ip
tag = cnt.indexOf("remark=") != -1 ? "tag=" + decodeURIComponent(cnt.split("remark=")[1].split("&")[0]) : tag
}
puri = ""
pudp = (Pudp == 1 || cnt.indexOf("udp=1")!=-1) ? "udp-relay=true" : "udp-relay=false";
@@ -2131,7 +2132,7 @@ function VL2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
if (typeU == "SR-URI") {//小火箭内的websocket写法
if(cnt.indexOf("obfs=none")!=-1 && cnt.indexOf("tls=1")==-1) {
obfs = ""
} else if(cnt.indexOf("obfs=none")!=-1 && cnt.indexOf("tls=1")!=-1) {
} else if((cnt.indexOf("obfs=none")!=-1 || cnt.indexOf("obfs=")==-1) && cnt.indexOf("tls=1")!=-1) {
obfs = "obfs=over-tls"
} else if(cnt.indexOf("obfs=http")!=-1) {
obfs = "obfs=http"