mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 13:05:10 +00:00
Update resource-parser.js
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2025-12-31 15:20⟧
|
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2026-01-07 13:45⟧
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/ShawnKOP_Parser_Bot
|
🛠 发现 𝐁𝐔𝐆 请反馈: https://t.me/ShawnKOP_Parser_Bot
|
||||||
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
||||||
@@ -3044,7 +3044,7 @@ function YAMLFix(cnt){
|
|||||||
cnt = cnt.replace(/(^|\n)- /g, "$1 - ").replace(/ - /g," - ").replace(/:(?!\s)/g,": ").replace(/\,\"/g,", \"").replace(/: {/g, ": {, ").replace(/, (Host|host|path|mux)/g,", $1")
|
cnt = cnt.replace(/(^|\n)- /g, "$1 - ").replace(/ - /g," - ").replace(/:(?!\s)/g,": ").replace(/\,\"/g,", \"").replace(/: {/g, ": {, ").replace(/, (Host|host|path|mux)/g,", $1")
|
||||||
//2022-04-11 remove tls|skip from replace(/, (Host|host|path|mux)/g,", $1")
|
//2022-04-11 remove tls|skip from replace(/, (Host|host|path|mux)/g,", $1")
|
||||||
console.log("1st:\n"+cnt)
|
console.log("1st:\n"+cnt)
|
||||||
cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:")
|
cnt = cnt.replace(/{\s*name: (.*?), (.*?):/g,"{name: \"$1\", $2:").replace(/, short-id/gi,", short-id") //cnt.replace(/{\s*name: /g,"{name: \"").replace(/, (.*?):/,"\", $1:")
|
||||||
cnt = cnt.replace(/{\s*|\s*}/g,"").replace(/,/g,"\n ")
|
cnt = cnt.replace(/{\s*|\s*}/g,"").replace(/,/g,"\n ")
|
||||||
}
|
}
|
||||||
cnt = cnt.replace(/\n\s*\-\s*\n.*name/g,"\n - name").replace(/\$|\`/g,"").split("proxy-providers:")[0].split("proxy-groups:")[0].replace(/\"(name|type|server|port|cipher|password|uuid|alterId|udp)(\"*)/g,"$1")
|
cnt = cnt.replace(/\n\s*\-\s*\n.*name/g,"\n - name").replace(/\$|\`/g,"").split("proxy-providers:")[0].split("proxy-groups:")[0].replace(/\"(name|type|server|port|cipher|password|uuid|alterId|udp)(\"*)/g,"$1")
|
||||||
@@ -3119,6 +3119,8 @@ function Clash2QX(cnt) {
|
|||||||
node = CH2QX(node)
|
node = CH2QX(node)
|
||||||
} else if (typecc == "socks5"){
|
} else if (typecc == "socks5"){
|
||||||
node = CS52QX(node)
|
node = CS52QX(node)
|
||||||
|
} else if (typecc == "vless"){
|
||||||
|
node = CVL2QX(node)
|
||||||
}
|
}
|
||||||
node = Pudp0 != 0 ? XUDP(node,Pudp0) : node
|
node = Pudp0 != 0 ? XUDP(node,Pudp0) : node
|
||||||
node = Ptfo0 != 0 ? XTFO(node,Ptfo0) : node
|
node = Ptfo0 != 0 ? XTFO(node,Ptfo0) : node
|
||||||
@@ -3296,6 +3298,44 @@ function CS52QX(cnt){
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clash vless type ,2026-01-07
|
||||||
|
function CVL2QX(cnt){
|
||||||
|
tag = "tag="+cnt.name.replace(/\\U.+?\s{1}/gi," ").replace(/(\"|\')/gi,"")
|
||||||
|
ipt = cnt.server+":"+cnt.port
|
||||||
|
pwd = "password=" + cnt.uuid
|
||||||
|
mtd = "method=none" //cnt.cipher
|
||||||
|
udp = cnt.udp ? "udp-relay=true" : "udp-relay=false"
|
||||||
|
tfo = cnt.tfo ? "fast-open=true" : "fast-open=false"
|
||||||
|
obfs = ""
|
||||||
|
if (cnt.network == "ws" && cnt.tls) {
|
||||||
|
obfs = "obfs=wss"
|
||||||
|
} else if (cnt.network == "ws"){
|
||||||
|
obfs = "obfs=ws"
|
||||||
|
} else if (cnt.tls){
|
||||||
|
obfs = "obfs=over-tls"
|
||||||
|
}
|
||||||
|
vfl=cnt.flow? "vless-flow=xtls-rprx-vision":""
|
||||||
|
const ppbk=getValue(()=>cnt["reality-opts"]["public-key"])
|
||||||
|
const psid=getValue(()=>cnt["reality-opts"]["short-id"])
|
||||||
|
pbk=ppbk? "reality-base64-pubkey="+ppbk : ""
|
||||||
|
sid=psid? "reality-hex-shortid="+psid : ""
|
||||||
|
// console.log(obfs)
|
||||||
|
const phost = getValue(()=>cnt["ws-opts"]["headers"]["Host"])
|
||||||
|
ohost = cnt["ws-headers"]? "obfs-host=" + cnt["ws-headers"]["Host"] : ""
|
||||||
|
ohost = phost ? "obfs-host="+phost : ohost
|
||||||
|
//ohost= cnt["ws-opts"]? "obfs-host=" + cnt["ws-opts"]["headers"]["Host"] : ohost
|
||||||
|
ohost = cnt["servername"]? "obfs-host=" + cnt["servername"] : ohost
|
||||||
|
cert = cnt["skip-cert-verify"] && cnt.tls ? "tls-verification=false" : ""
|
||||||
|
//$notify(cert)
|
||||||
|
if (Pcert0 == 1 && cnt.tls) {
|
||||||
|
cert = "tls-verification=true"
|
||||||
|
} else if (Pcert0 != 1 && cnt.tls) {
|
||||||
|
cert = "tls-verification=false"
|
||||||
|
}
|
||||||
|
node = "vless="+[ipt, pwd, mtd, udp, tfo, obfs, ohost, vfl, pbk, sid, cert, tag].filter(Boolean).join(", ")
|
||||||
|
//console.log(node)
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
// UDP/TFO 参数 (强制 surge/quanx 类型转换)
|
// UDP/TFO 参数 (强制 surge/quanx 类型转换)
|
||||||
function XUDP(cnt,pudp) {
|
function XUDP(cnt,pudp) {
|
||||||
|
|||||||
Reference in New Issue
Block a user