mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 17:15:09 +00:00
Merge pull request #97 from 1nC0deWeTrust/master
Update resource-parser.js
This commit is contained in:
@@ -1430,6 +1430,7 @@ function rule_list_handle(cnt) {
|
||||
} else if (cnt.indexOf("payload:") == -1) { //host - suffix, not clash rule list
|
||||
//$notify("xxx","xxxx",cnt)
|
||||
//cnt=cnt.replace(/'|"/g,"").trim()//replace(/'|"|\+\.|\*\.|\*\.\*/g,"") 2023-04-10
|
||||
|
||||
if (!/^('|")/.test(cnt)) { // not clash-provider
|
||||
if (!/\*|\+/.test(cnt[0])) {
|
||||
cnt = cnt[0] == "." ? cnt.replace(".", "") : cnt
|
||||
@@ -1439,15 +1440,17 @@ function rule_list_handle(cnt) {
|
||||
}
|
||||
} else { // clash provider
|
||||
cnt = cnt.replace(/'|"/g, "").trim()
|
||||
if ( /^(\*\.|\.)/.test(cnt) || cnt.indexOf("*")!=-1) {
|
||||
cnt = "host-wildcard, " + cnt
|
||||
|
||||
if (/^\.|\*\./.test(cnt) || cnt.indexOf("*") != -1) {
|
||||
//1.以.或*.开头 -> 匹配子域名,wildcard,*.domain
|
||||
//2.直接替换开头,正则未匹配 -> 不以*.开头的字符串但包含*的情况(wildcard,a.*.domain...)
|
||||
cnt = "host-wildcard, " + cnt.replace(/^\.|\*\./, "*.")
|
||||
} else {
|
||||
cnt = "host-suffix, " + cnt.replace(/\+\./,"")
|
||||
cnt = "host-suffix, " + cnt.replace(/^(\+\.)/, "")//如果以+.开头 = 匹配当前域名及其子域名,采用 suffix,domain。
|
||||
}
|
||||
}
|
||||
cnt = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
|
||||
}
|
||||
|
||||
}
|
||||
return cnt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user