Update resource-parser.js

This commit is contained in:
1nC0deWeTrust
2023-04-12 10:58:26 +08:00
committed by GitHub
parent 3a85bbc4ec
commit de5a84bcce

View File

@@ -1430,11 +1430,15 @@ 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[0])) {
cnt = cnt[0]=="." ? cnt.replace(".",""): cnt
cnt = "host-suffix, " + cnt
} else {
//clash中以.或*.开头匹配的都是子域名只存在匹配层级区别qx中有无此设计不明只能确定*可用
if (/^\.|\*\./.test(cnt)) {//以.开头 = 匹配子域名 .stun.playstation.net/*.stun.playstation.net -> *.stun.playstation.net
cnt = "host-wildcard, " + cnt.replace(/^\.|\*\./, "*.")
} 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 = Ppolicy == "Shawn" ? cnt + ", Shawn" : cnt + ", " + Ppolicy
}