mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 21:25:09 +00:00
Update resource-parser.js
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-04-12 13:35⟧
|
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2023-04-18 10:50⟧
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot
|
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/Shawn_Parser_Bot
|
||||||
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
||||||
@@ -1539,12 +1539,12 @@ function Subs2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
|
|||||||
var type = list0[i].split("://")[0].trim()
|
var type = list0[i].split("://")[0].trim()
|
||||||
var listi = list0[i].replace(/ /g, "")
|
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] : ""
|
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 NodeCheck = (item) => listi.toLowerCase().indexOf(item) != -1;
|
||||||
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) && !/(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])
|
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)
|
||||||
@@ -1552,7 +1552,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 || /(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 = 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 类型
|
||||||
@@ -1765,13 +1765,20 @@ function VQ2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
|
|||||||
//Shadowrocket 格式的 vmess URI 转换
|
//Shadowrocket 格式的 vmess URI 转换
|
||||||
function VR2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {
|
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]
|
||||||
|
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 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, "
|
||||||
var tag = /remarks*=/.test(subs)? "tag=" + decodeURIComponent(subs.split(/remarks*=/)[1].split("&")[0]) : "tag="+server.split("@")[1] //部分无节点名的情况
|
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 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
|
||||||
node = ip + tfo + udp
|
node = ip + pwd+ tfo + udp
|
||||||
var obfs = subs.indexOf("obfs=")!=-1 ? subs.split("obfs=")[1].split("&")[0].trim() : "none"
|
var obfs = subs.indexOf("obfs=")!=-1 ? subs.split("obfs=")[1].split("&")[0].trim() : "none"
|
||||||
if (obfs == "none") { //
|
if (obfs == "none") { //
|
||||||
obfs = subs.indexOf("tls=1") != -1 ? "obfs=over-tls, " : "" //over-tls
|
obfs = subs.indexOf("tls=1") != -1 ? "obfs=over-tls, " : "" //over-tls
|
||||||
@@ -2468,6 +2475,7 @@ function get_emoji(emojip, sname) {
|
|||||||
"🇧🇩": ["孟加拉", "Bengal"],
|
"🇧🇩": ["孟加拉", "Bengal"],
|
||||||
"🇲🇽️": [" MEX", "MX", "墨西哥", "Mexico", "MEXICO"],
|
"🇲🇽️": [" MEX", "MX", "墨西哥", "Mexico", "MEXICO"],
|
||||||
"🇲🇾": [" MY", "Malaysia","MALAYSIA", "马来西亚", "马来", "馬來", "大马", "大馬", "馬來西亞", "吉隆坡"],
|
"🇲🇾": [" MY", "Malaysia","MALAYSIA", "马来西亚", "马来", "馬來", "大马", "大馬", "馬來西亞", "吉隆坡"],
|
||||||
|
"🇲🇲": ["缅甸"],
|
||||||
"🇳🇱": [" NL", "Netherlands", "荷兰", "荷蘭", "尼德蘭", "阿姆斯特丹"],
|
"🇳🇱": [" NL", "Netherlands", "荷兰", "荷蘭", "尼德蘭", "阿姆斯特丹"],
|
||||||
"🇵🇭": [" PH", "Philippines", "菲律宾", "菲律賓"],
|
"🇵🇭": [" PH", "Philippines", "菲律宾", "菲律賓"],
|
||||||
"🇷🇴": [" RO ", "罗马尼亚", "Rumania"],
|
"🇷🇴": [" RO ", "罗马尼亚", "Rumania"],
|
||||||
|
|||||||
Reference in New Issue
Block a user