MCPcopy Index your code
hub / github.com/Moli-X/Resources / isQuanXRewrite

Function isQuanXRewrite

Script/Parser.js:2116–2153  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

2114
2115//surge script/quanx-rewrite - > quanx
2116function isQuanXRewrite(content) {
2117 cnt = content
2118 cnt0=[]
2119 var RuleK = ["host,", "-suffix,", "domain,", "-keyword,", "ip-cidr,", "ip-cidr6,", "geoip,", "user-agent,", "ip6-cidr,","force-http", "ip-asn"];
2120 for (var i = 0; i< cnt.length; i++){
2121 if(cnt[i]){
2122 var cnti = cnt[i].trim()
2123 const RuleCheck = (item) => cnti.toLowerCase().indexOf(item) != -1;
2124 if (cnti.indexOf("pattern")!=-1 && cnti.indexOf("type")!=-1 || cnti.indexOf("http-r")!=-1) {
2125 cnti=SGMD2QX(cnti)[0]? SGMD2QX(cnti)[0]:""
2126 //console.log(cnti)
2127 }else if ((cnti.indexOf(" 302")!=-1 || cnti.indexOf(" 307")!=-1 || (/\s(_|-)\sreject/.test(cnti)) || (/\sreject$/.test(cnti))) && cnti.indexOf(" url ")==-1 && cnti.indexOf(" url-and-header ")==-1 ){
2128 cnti=SGMD2QX(cnti)[0]? SGMD2QX(cnti)[0]:""
2129 //console.log("sss",cnti)
2130 }else if(cnti.indexOf(" data=")!=-1){
2131 cnti = SGMD2QX("[Map Local]\n"+cnti)[0]? SGMD2QX("[Map Local]\n"+cnti)[0]:""
2132 //cnti=cnti.replace(/ /g, "").split("data=")[0] + " url " + "reject-dict"
2133 }else if(cnti.indexOf("URL-REGEX")!=-1 || cnti.indexOf(" header")!=-1 || cnti.replace(/ /g,"").indexOf("hostname=")!=-1){
2134 cnti=SGMD2QX(cnti)[0]? SGMD2QX(cnti)[0]:""
2135 }else if (cnti.indexOf(" url ")!=-1 && cnti.indexOf(" simple-response ")==-1 && cnti.indexOf(" url = ")==-1){ // 2023-03-09 去掉 quan类型的 simple- response
2136 cnti = cnti.replace("^http","http") // 去掉 ^ 以去重
2137 cnti= cnti.split(" ")[1] == "url" ? cnti : ""
2138 } else if (cnti.indexOf(" url-and-header ")!=-1 ){ // url-and-header : ^https:xxx.com header-content url-and-header type-rule content
2139 cnti= cnti //cnti.split(" ")[2] == "url-and-header" ? cnti : ""
2140 } else {
2141 cnti=""
2142 }
2143 if (cnti!="" && cnti.trim()[0]!="[" && cnti.indexOf("RULE-SET")==-1 && !/cronexp\=|type\=cron/.test(cnti.replace(/ /g,"")) && !RuleK.some(RuleCheck)) {
2144 if (!(/\;$/.test(cnti))) { // 某些特殊情形 let url = xxx;
2145 cnt0.push(cnti) // 排除其它项目后写入
2146 }
2147 }
2148 }
2149 }
2150 //console.log(cnt0)
2151 //$notify("RWT","",cnt0)
2152 return cnt0
2153}
2154
2155
2156

Callers 1

ResourceParseFunction · 0.85

Calls 3

SGMD2QXFunction · 0.85
indexOfMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…