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:
@@ -1429,16 +1429,24 @@ function rule_list_handle(cnt) {
|
|||||||
cnt = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
|
cnt = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
|
||||||
} else if (cnt.indexOf("payload:") == -1) { //host - suffix, not clash rule list
|
} else if (cnt.indexOf("payload:") == -1) { //host - suffix, not clash rule list
|
||||||
//$notify("xxx","xxxx",cnt)
|
//$notify("xxx","xxxx",cnt)
|
||||||
cnt = cnt.replace(/'|"/g, "").trim()//replace(/'|"|\+\.|\*\.|\*\.\*/g,"") 2023-04-10
|
//cnt=cnt.replace(/'|"/g,"").trim()//replace(/'|"|\+\.|\*\.|\*\.\*/g,"") 2023-04-10
|
||||||
//clash中以.或*.开头匹配的都是子域名,只存在匹配层级区别,qx中有无此设计不明,只能确定*可用
|
if (!/^('|")/.test(cnt)) { // not clash-provider
|
||||||
if (/^\.|\*\./.test(cnt)) {//以.开头 = 匹配子域名 .stun.playstation.net/*.stun.playstation.net -> *.stun.playstation.net
|
if (!/\*|\+/.test(cnt[0])) {
|
||||||
cnt = "host-wildcard, " + cnt.replace(/^\.|\*\./, "*.")
|
cnt = cnt[0] == "." ? cnt.replace(".", "") : cnt
|
||||||
} else if (/^(\+\.)/.test(cnt)) {//以+.开头 = 匹配当前域名及其子域名,走后缀匹配即可 +.xboxlive.com -> suffix xboxlive.com
|
|
||||||
cnt = "host-suffix, " + cnt.replace(/^(\+\.)/, "")
|
|
||||||
} else if (cnt.indexOf("*") != -1) {//不以*.开头的字符串中包含*的情况 -> 保持该规则
|
|
||||||
cnt = "host-wildcard, " + cnt
|
|
||||||
} else {
|
|
||||||
cnt = "host-suffix, " + cnt
|
cnt = "host-suffix, " + cnt
|
||||||
|
} else {
|
||||||
|
cnt = "host-wildcard, " + cnt
|
||||||
|
}
|
||||||
|
} else { // clash provider
|
||||||
|
cnt = cnt.replace(/'|"/g, "").trim()
|
||||||
|
|
||||||
|
if (/^\.|\*\./.test(cnt) || cnt.indexOf("*") != -1) {
|
||||||
|
//1.以.或*.开头 -> 匹配子域名,wildcard,*.domain
|
||||||
|
//2.直接替换开头,正则未匹配 -> 不以*.开头的字符串但包含*的情况(wildcard,a.*.domain...)
|
||||||
|
cnt = "host-wildcard, " + cnt.replace(/^\.|\*\./, "*.")
|
||||||
|
} else {
|
||||||
|
cnt = "host-suffix, " + cnt.replace(/^(\+\.)/, "")//如果以+.开头 = 匹配当前域名及其子域名,采用 suffix,domain。
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cnt = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
|
cnt = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user