mirror of
https://github.com/KOP-XIAO/QuantumultX.git
synced 2026-01-25 21:25:09 +00:00
hostname单独参数
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2020-06-21 07:59⟧
|
☑️ 资源解析器 ©𝐒𝐡𝐚𝐰𝐧 ⟦2020-06-21 13:59⟧
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
🚫 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot
|
🚫 发现 𝐁𝐔𝐆 请反馈: @Shawn_KOP_bot
|
||||||
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
⛳️ 关注 🆃🅶 相关频道: https://t.me/QuanX_API
|
||||||
@@ -34,6 +34,7 @@ B. rewrite(重写) /filter(分流) 的转换&筛选
|
|||||||
|
|
||||||
2⃣️ ⟦rewrite 重写⟧/⟦filter 分流⟧ ➠ 参数说明:
|
2⃣️ ⟦rewrite 重写⟧/⟦filter 分流⟧ ➠ 参数说明:
|
||||||
⦿ in, out, 根据关键词 保留/禁用 相关的规则、重写;
|
⦿ in, out, 根据关键词 保留/禁用 相关的规则、重写;
|
||||||
|
⦿ inhn, outhn, 根据关键词 保留/删除 相关的主机名(hostname);
|
||||||
⦿ 分流规则另有 "policy=xxx" 参数, 可用于直接指定策略组,或为 Surge 类型 rule-set 生成策略组(默认"Shawn"策略组);
|
⦿ 分流规则另有 "policy=xxx" 参数, 可用于直接指定策略组,或为 Surge 类型 rule-set 生成策略组(默认"Shawn"策略组);
|
||||||
⦿ 示范: 禁用某重写引用中的 "淘宝比价 js" 以及 "weibo 的 js"
|
⦿ 示范: 禁用某重写引用中的 "淘宝比价 js" 以及 "weibo 的 js"
|
||||||
⚠️ ☞ https://myrewrite.list#out=tb_price.js+wb_ad.js
|
⚠️ ☞ https://myrewrite.list#out=tb_price.js+wb_ad.js
|
||||||
@@ -62,10 +63,13 @@ var link0=$resource.link;
|
|||||||
var para=(link0.indexOf("http")!=-1 && link0.indexOf("://")!=-1)? link0:link0+content0.split("\n")[0];
|
var para=(link0.indexOf("http")!=-1 && link0.indexOf("://")!=-1)? link0:link0+content0.split("\n")[0];
|
||||||
var mark0=para.indexOf("#")!=-1? true:false;
|
var mark0=para.indexOf("#")!=-1? true:false;
|
||||||
var type0=Type_Check(content0);
|
var type0=Type_Check(content0);
|
||||||
//$notify(link0,"type",para)
|
|
||||||
para1=para.slice(para.indexOf("#")+1) //防止参数中其它位置也存在"#"
|
para1=para.slice(para.indexOf("#")+1) //防止参数中其它位置也存在"#"
|
||||||
var Pin0=mark0 && para1.indexOf("in=")!=-1? (para1.split("in=")[1].split("&")[0].split("+")).map(decodeURIComponent):null;
|
var Pin0=mark0 && para1.indexOf("in=")!=-1? (para1.split("in=")[1].split("&")[0].split("+")).map(decodeURIComponent):null;
|
||||||
var Pout0=mark0 && para1.indexOf("out=")!=-1? (para1.split("out=")[1].split("&")[0].split("+")).map(decodeURIComponent):null;
|
var Pout0=mark0 && para1.indexOf("out=")!=-1? (para1.split("out=")[1].split("&")[0].split("+")).map(decodeURIComponent):null;
|
||||||
|
//$notify(link0,"type0",para)
|
||||||
|
var Phin0=mark0 && para1.indexOf("inhn=")!=-1? (para1.split("inhn=")[1].split("&")[0].split("+")).map(decodeURIComponent):null; //hostname
|
||||||
|
var Phout0=mark0 && para1.indexOf("outhn=")!=-1? (para1.split("outhn=")[1].split("&")[0].split("+")).map(decodeURIComponent):null; //hostname
|
||||||
|
//$notify(link0,"type1",para)
|
||||||
var Pemoji=mark0 && para1.indexOf("emoji=")!=-1? para1.split("emoji=")[1].split("&")[0]:null;
|
var Pemoji=mark0 && para1.indexOf("emoji=")!=-1? para1.split("emoji=")[1].split("&")[0]:null;
|
||||||
var Pudp0=mark0 && para1.indexOf("udp=")!=-1? para1.split("udp=")[1].split("&")[0]:0;
|
var Pudp0=mark0 && para1.indexOf("udp=")!=-1? para1.split("udp=")[1].split("&")[0]:0;
|
||||||
var Ptfo0=mark0 && para1.indexOf("tfo=")!=-1? para1.split("tfo=")[1].split("&")[0]:0;
|
var Ptfo0=mark0 && para1.indexOf("tfo=")!=-1? para1.split("tfo=")[1].split("&")[0]:0;
|
||||||
@@ -79,6 +83,11 @@ var PTls13=mark0 && para1.indexOf("tls13=")!=-1? para1.split("tls13=")[1].split(
|
|||||||
var Pntf0= mark0 && para1.indexOf("ntf=")!=-1? para1.split("ntf=")[1].split("&")[0]:0;
|
var Pntf0= mark0 && para1.indexOf("ntf=")!=-1? para1.split("ntf=")[1].split("&")[0]:0;
|
||||||
var Pb64= mark0 && para1.indexOf("b64=")!=-1? para1.split("b64=")[1].split("&")[0]:0;
|
var Pb64= mark0 && para1.indexOf("b64=")!=-1? para1.split("b64=")[1].split("&")[0]:0;
|
||||||
var emojino=[" 0️⃣ "," 1⃣️ "," 2⃣️ "," 3⃣️ "," 4⃣️ "," 5⃣️ "," 6⃣️ "," 7⃣️ "," 8⃣️ "," 9⃣️ "," 🔟 "]
|
var emojino=[" 0️⃣ "," 1⃣️ "," 2⃣️ "," 3⃣️ "," 4⃣️ "," 5⃣️ "," 6⃣️ "," 7⃣️ "," 8⃣️ "," 9⃣️ "," 🔟 "]
|
||||||
|
var pfi=Pin0? "in="+Pin0+", ":""
|
||||||
|
var pfo=Pout0? "out="+Pout0:""
|
||||||
|
var pfihn=Phin0? "inhn="+Phin0+", ":""
|
||||||
|
var pfohn=Phout0? "outhn="+Phout0:""
|
||||||
|
|
||||||
const subinfo=$resource.info;
|
const subinfo=$resource.info;
|
||||||
const subtag=$resource.tag!=undefined? $resource.tag:"";
|
const subtag=$resource.tag!=undefined? $resource.tag:"";
|
||||||
const Base64=new Base64Code();
|
const Base64=new Base64Code();
|
||||||
@@ -248,11 +257,13 @@ function Rewrite_Filter(subs,Pin,Pout){
|
|||||||
continue;
|
continue;
|
||||||
}else if(hnc==0 && subii.indexOf("hostname=")==0){ //host name 部分
|
}else if(hnc==0 && subii.indexOf("hostname=")==0){ //host name 部分
|
||||||
//console.log("hostname");
|
//console.log("hostname");
|
||||||
hostname=HostNamecheck(subi,Pin,Pout);
|
hostname=(Phin0||Phout0)? 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);
|
||||||
|
//if(inflag==1){$notify(inflag)}
|
||||||
var outflag=Rcheck(subi,Pout);
|
var outflag=Rcheck(subi,Pout);
|
||||||
if(outflag==1){
|
if(outflag==1 || inflag==0){
|
||||||
|
//$notify("a","b",subi)
|
||||||
dwrite.push(subi); //out 命中
|
dwrite.push(subi); //out 命中
|
||||||
}else if(outflag==0 && inflag!=0){ //out 未命中 && in 未排除
|
}else if(outflag==0 && inflag!=0){ //out 未命中 && in 未排除
|
||||||
Nlist.push(subi);
|
Nlist.push(subi);
|
||||||
@@ -264,9 +275,9 @@ function Rewrite_Filter(subs,Pin,Pout){
|
|||||||
}
|
}
|
||||||
if(dwrite.length>0){
|
if(dwrite.length>0){
|
||||||
nowrite=dwrite.length<=10?emojino[dwrite.length]:dwrite.length
|
nowrite=dwrite.length<=10?emojino[dwrite.length]:dwrite.length
|
||||||
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 禁用: "+Pout0.join(", "),"☠️ 重写 rewrite 中已禁用以下"+nowrite+"个匹配项:"+"\n ⨷ "+dwrite.join("\n ⨷ "),rwrite_link )
|
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 筛选参数: "+pfi+pfo,"☠️ 重写 rewrite 中已禁用以下"+nowrite+"个匹配项:"+"\n ⨷ "+dwrite.join("\n ⨷ "),rwrite_link )
|
||||||
}
|
}
|
||||||
if(Nlist.length==0){$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","✅ 保留: "+Pin+",⛔️ 禁用: "+Pout,"⚠️ 筛选后剩余rewrite规则数为 0️⃣ 条, 请检查参数及原始链接",nan_link)}
|
if(Nlist.length==0){$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 筛选参数: "+pfi+pfo,"⚠️ 筛选后剩余rewrite规则数为 0️⃣ 条, 请检查参数及原始链接",nan_link)}
|
||||||
if(hostname!=""){Nlist.push(hostname)}
|
if(hostname!=""){Nlist.push(hostname)}
|
||||||
return Nlist
|
return Nlist
|
||||||
}
|
}
|
||||||
@@ -279,31 +290,33 @@ function HostNamecheck(content,parain,paraout){
|
|||||||
for(i=0;i<hname.length;i++){
|
for(i=0;i<hname.length;i++){
|
||||||
dd=hname[i]
|
dd=hname[i]
|
||||||
const excludehn = (item) => dd.indexOf(item)!=-1;
|
const excludehn = (item) => dd.indexOf(item)!=-1;
|
||||||
if(paraout && paraout!=""){
|
if(paraout && paraout!=""){ //存在 out 参数时
|
||||||
if(!paraout.some(excludehn)){
|
if(!paraout.some(excludehn)){ //out 未命中🎯️
|
||||||
if(parain && parain!=""){
|
if(parain && parain!=""){
|
||||||
if(parain.some(excludehn)){ //Pin
|
if(parain.some(excludehn)){ //Pin 命中🎯️
|
||||||
nname.push(hname[i])
|
nname.push(hname[i])
|
||||||
}
|
} else{$notify("..xx")
|
||||||
}else{nname.push(hname[i])}
|
dname.push(hname[i])} //Pin 未命中🎯️的记录
|
||||||
}else{dname.push(hname[i])}
|
}else{nname.push(hname[i])} //无in 参数
|
||||||
}else if(parain && parain!=""){
|
}else{dname.push(hname[i])} //out 参数命中
|
||||||
if(parain.some(excludehn)){ //Pin
|
}else if(parain && parain!=""){ //不存在 out,但有 in 参数时
|
||||||
|
if(parain.some(excludehn)){ //Pin 命中🎯️
|
||||||
nname.push(hname[i])
|
nname.push(hname[i])
|
||||||
}
|
}else{dname.push(hname[i])}
|
||||||
}else {
|
}else {
|
||||||
nname.push(hname[i])
|
nname.push(hname[i])
|
||||||
}
|
}
|
||||||
} //for j
|
} //for j
|
||||||
hname="hostname="+nname.join(", ");
|
hname="hostname="+nname.join(", ");
|
||||||
|
// $notify(hname,dname)
|
||||||
if(dname.length>0){
|
if(dname.length>0){
|
||||||
if(paraout && paraout!=""){
|
if(paraout || parain){
|
||||||
var noname=dname.length<=10?emojino[dname.length]:dname.length
|
var noname=dname.length<=10?emojino[dname.length]:dname.length
|
||||||
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 禁用: "+paraout,"☠️ 主机名 hostname 中已删除以下"+noname+"个匹配项:"+"\n ⨷ "+dname.join(","),rwrite_link )
|
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 筛选参数: "+pfihn+pfohn,"☠️ 主机名 hostname 中已删除以下"+noname+"个匹配项:"+"\n ⨷ "+dname.join(","),rwrite_link )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(nname.length==0){
|
if(nname.length==0){
|
||||||
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","✅ 保留: "+parain+",⛔️ 禁用: "+paraout,"⚠️ 主机名 hostname 中剩余 0️⃣ 项, 请检查参数及原始链接",nan_link )
|
$notify("🤖 "+"重写引用 ➟ "+"⟦"+subtag+"⟧","⛔️ 筛选参数: "+pfihn+pfohn,"⚠️ 主机名 hostname 中剩余 0️⃣ 项, 请检查参数及原始链接",nan_link )
|
||||||
}
|
}
|
||||||
return hname
|
return hname
|
||||||
}
|
}
|
||||||
@@ -642,8 +655,6 @@ function Filter(servers,Pin,Pout){
|
|||||||
}//for
|
}//for
|
||||||
if(Pntf0!=0 && Delist.length>=1){//通知部分
|
if(Pntf0!=0 && Delist.length>=1){//通知部分
|
||||||
var no= Delist.length<=10? emojino[ Delist.length]:Delist.length ;
|
var no= Delist.length<=10? emojino[ Delist.length]:Delist.length ;
|
||||||
var pfi=Pin? "in="+Pin:""
|
|
||||||
var pfo=Pout? "out="+Pout:""
|
|
||||||
$notify("👥 引用"+"⟦"+subtag+"⟧"+" 开始节点筛选","🕹 筛选关键字: "+pfi+pfo, "☠️ 已删除以下 "+no+"个节点\n"+" ⨁ "+Delist.join(", "),sub_link);
|
$notify("👥 引用"+"⟦"+subtag+"⟧"+" 开始节点筛选","🕹 筛选关键字: "+pfi+pfo, "☠️ 已删除以下 "+no+"个节点\n"+" ⨁ "+Delist.join(", "),sub_link);
|
||||||
}
|
}
|
||||||
return Nlist
|
return Nlist
|
||||||
|
|||||||
Reference in New Issue
Block a user