Update resource-parser.js

This commit is contained in:
Shawn
2021-03-28 18:33:41 +08:00
parent 6a15ec7b3f
commit 13b9193b29

View File

@@ -1,5 +1,5 @@
/** /**
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-03-28 14:20⟧ ☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2021-03-28 18:20⟧
---------------------------------------------------------- ----------------------------------------------------------
🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot 🛠 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API ⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
@@ -383,7 +383,7 @@ function Type_Check(subs) {
} else if (ClashK.some(NodeCheck) || typeU == "clash"){ // Clash 类型节点转换 } else if (ClashK.some(NodeCheck) || typeU == "clash"){ // Clash 类型节点转换
type = "Clash"; type = "Clash";
content0 = Clash2QX(subs) content0 = Clash2QX(subs)
} else if ((/hostname\=|pattern\=/.test(subs) || RewriteK.some(RewriteCheck)) && !/\[(Proxy|filter_local)\]/.test(subs) && para1.indexOf("dst=filter")==-1 && subi.indexOf("securehostname") == -1 && !/module|nodes/.test(typeU)) { } else if ((/^hostname\s*\=|pattern\=/.test(subi) || RewriteK.some(RewriteCheck)) && !/\[(Proxy|filter_local)\]/.test(subs) && para1.indexOf("dst=filter")==-1 && subi.indexOf("securehostname") == -1 && !/module|nodes/.test(typeU)) {
type = "rewrite" //Quantumult X 类型 rewrite/ Surge Script/ 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") && typeU != "nodes") { // Surge 类型 module /rule-set(含url-regex) 类型 } else if ( (((ModuleK.some(RewriteCheck) || para1.indexOf("dst=rewrite") != -1) && (para1.indexOf("dst=filter") == -1) && subs.indexOf("[Proxy]") == -1) || typeU == "module") && typeU != "nodes") { // Surge 类型 module /rule-set(含url-regex) 类型
type = "sgmodule" type = "sgmodule"
@@ -718,7 +718,7 @@ function Rewrite_Filter(subs, Pin, Pout,Preg) {
if (noteK.some(notecheck)) { // 注释项跳过 if (noteK.some(notecheck)) { // 注释项跳过
continue; continue;
} else if (hnc == 0 && subii.indexOf("hostname=") == 0) { //hostname 部分 } else if (hnc == 0 && subii.indexOf("hostname=") == 0) { //hostname 部分
hostname = (Phin0 || Phout0) ? HostNamecheck(subi, Phin0, Phout0) : subi;//hostname 部分 hostname = (Phin0 || Phout0 || Preg) ? HostNamecheck(subi, Phin0, Phout0) : subi;//hostname 部分
} else if (subii.indexOf("hostname=") != 0) { //rewrite 部分 } else if (subii.indexOf("hostname=") != 0) { //rewrite 部分
var inflag = Rcheck(subi, Pin); var inflag = Rcheck(subi, Pin);
var outflag = Rcheck(subi, Pout); var outflag = Rcheck(subi, Pout);
@@ -790,7 +790,7 @@ function HostNamecheck(content, parain, paraout) {
$notify("🤖 " + "重写引用 ➟ " + "⟦" + subtag + "⟧", "⛔️ 筛选参数: " + pfihn + pfohn, "⚠️ 主机名 hostname 中剩余 0⃣ 项, 请检查参数及原始链接", nan_link) $notify("🤖 " + "重写引用 ➟ " + "⟦" + subtag + "⟧", "⛔️ 筛选参数: " + pfihn + pfohn, "⚠️ 主机名 hostname 中剩余 0⃣ 项, 请检查参数及原始链接", nan_link)
} }
if(Preg){ nname = nname.map(Regex).filter(Boolean) if(Preg){ nname = nname.map(Regex).filter(Boolean)
RegCheck(nname, "主机名", Preg) } RegCheck(nname, "主机名hostname", Preg) }
hname = "hostname=" + nname.join(", "); hname = "hostname=" + nname.join(", ");
return hname return hname
} }