From ae53b97ac4b42578a485dc827b7cc6fe553e82bc Mon Sep 17 00:00:00 2001 From: Shawn <45581750+KOP-XIAO@users.noreply.github.com> Date: Fri, 6 May 2022 17:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=8D=E5=A4=8D=E6=80=A7?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/resource-parser.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Scripts/resource-parser.js b/Scripts/resource-parser.js index 52d9bed..48df823 100644 --- a/Scripts/resource-parser.js +++ b/Scripts/resource-parser.js @@ -1,5 +1,5 @@ /** -☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2022-05-06 15:03⟧ +☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2022-05-06 18:03⟧ ---------------------------------------------------------- 🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_Parser_Bot ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API @@ -288,6 +288,8 @@ function ResourceParse() { flag = 2; total = Rewrite_Filter(isQuanXRewrite(content0.split("\n")), Pin0, Pout0,Preg,Pregout); if (Preplace) { total = ReplaceReg(total, Preplace) } + // rewrite重复检测 + total = total.filter( (ele,pos)=>total.indexOf(ele) == pos); if (Pcdn) {total = CDN(total) } else {total = total.join("\n")} } else if (type0 == "Rule") { // rule 类型, 已处理完毕 @@ -303,6 +305,8 @@ function ResourceParse() { } if (Preplace) { total = ReplaceReg(total, Preplace) } if (Ppolicyset) {total = policy_sets(total, Ppolicyset)} + // filter 重复检测 + total = total.filter( (ele,pos)=>total.indexOf(ele) == pos) total = total.join("\n") } else if (content0.trim() == "") { $notify("‼️ 引用" + "⟦" + subtag + "⟧" + " 返回內容为空", "⁉️ 点通知跳转以确认链接是否失效", para.split("#")[0], nan_link); @@ -1831,7 +1835,7 @@ function isQuanXRewrite(content) { for (var i = 0; i< cnt.length; i++){ if(cnt[i]){ - var cnti = cnt[i] + var cnti = cnt[i].trim() const RuleCheck = (item) => cnti.toLowerCase().indexOf(item) != -1; if (cnti.indexOf("pattern")!=-1 && cnti.indexOf("type")!=-1 || cnti.indexOf("http-r")!=-1) { @@ -1846,8 +1850,10 @@ function isQuanXRewrite(content) { cnti=cnti.replace(/ /g, "").split("data=")[0] + " url " + "reject-dict" } if (cnti.trim()[0]!="[" && cnti.indexOf("RULE-SET")==-1 && !/cronexp\=|type\=cron/.test(cnti.replace(/ /g,"")) && !RuleK.some(RuleCheck)) { + if (!(/\;$/.test(cnti))) { // 某些特殊情形 let url = xxx; cnt0.push(cnti) // 排除其它项目后写入 } + } } } //console.log(cnt0)