diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index f30b855..d5ac5f3 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2020-12-11 18:59⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2020-12-14 21:59⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -324,7 +324,7 @@ function Type_Check(subs) { } else if (ClashK.some(NodeCheck) || typeU == "clash"){ // Clash 类型节点转换 type = "Clash"; content0 = Clash2QX(subs) - } else if ((subi.indexOf("hostname=") != -1 || RewriteK.some(RewriteCheck) || subi.indexOf("pattern=") != -1) && subs.indexOf("[Proxy]") == -1 && subs.indexOf("[server_local]") == -1 && para1.indexOf("dst=filter")==-1 && subi.indexOf("securehostname") == -1) { + } else if ((subi.indexOf("hostname=") != -1 || RewriteK.some(RewriteCheck) || subi.indexOf("pattern=") != -1) && subs.indexOf("[Proxy]") == -1 && subs.indexOf("[server_local]") == -1 && para1.indexOf("dst=filter")==-1 && subi.indexOf("securehostname") == -1 && typeU != "module") { type = "rewrite" //Quantumult X 类型 rewrite/ Surge Script/ } else if ( ((ModuleK.some(RewriteCheck) || para1.indexOf("dst=rewrite") != -1) && (para1.indexOf("dst=filter") == -1) && subs.indexOf("[Proxy]") == -1) || typeU == "module") { // Surge 类型 module /rule-set(含url-regex) 类型 type = "sgmodule" @@ -1175,9 +1175,13 @@ function isQuanX(content) { function isQuanXRewrite(content) { cnt = content cnt0=[] + var RuleK = ["host,", "-suffix,", "domain,", "-keyword,", "ip-cidr,", "ip-cidr6,", "geoip,", "user-agent,", "ip6-cidr,"]; + for (var i = 0; i< cnt.length; i++){ if(cnt[i]){ var cnti = cnt[i] + const RuleCheck = (item) => cnti.toLowerCase().indexOf(item) != -1; + if (cnti.indexOf("pattern")!=-1 && cnti.indexOf("type")!=-1 || cnti.indexOf("http-r")!=-1) { cnti=SGMD2QX(cnti)[0]? SGMD2QX(cnti)[0]:"" //console.log(cnti) @@ -1189,7 +1193,7 @@ function isQuanXRewrite(content) { }else if(cnti.indexOf(" data=")!=-1){ cnti=cnti.replace(/ /g, "").split("data=")[0] + " url " + "reject-dict" } - if (cnti.trim()[0]!="[" && cnti.indexOf("RULE-SET")==-1) { + if (cnti.trim()[0]!="[" && cnti.indexOf("RULE-SET")==-1 && !RuleK.some(RuleCheck)) { cnt0.push(cnti) } } @@ -1199,6 +1203,7 @@ function isQuanXRewrite(content) { } + //根据节点名排序(不含emoji 部分) function QXSort(content, para) { var nlist = content;//.split("\n");