mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-07-29 22:02:00 +08:00
feat: 优化去除无效节点逻辑 感谢群友 Cooip JM
This commit is contained in:
parent
4ea84118c4
commit
dbf9e7c360
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.435",
|
"version": "2.14.436",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -699,24 +699,45 @@ function isIP(ip) {
|
|||||||
|
|
||||||
ResolveDomainOperator.resolver = DOMAIN_RESOLVERS;
|
ResolveDomainOperator.resolver = DOMAIN_RESOLVERS;
|
||||||
|
|
||||||
|
function isAscii(str) {
|
||||||
|
// eslint-disable-next-line no-control-regex
|
||||||
|
var pattern = /^[\x00-\x7F]+$/; // ASCII 范围的 Unicode 编码
|
||||||
|
return pattern.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
/**************************** Filters ***************************************/
|
/**************************** Filters ***************************************/
|
||||||
// filter useless proxies
|
// filter useless proxies
|
||||||
function UselessFilter() {
|
function UselessFilter() {
|
||||||
const KEYWORDS = [
|
|
||||||
'网址',
|
|
||||||
'流量',
|
|
||||||
'时间',
|
|
||||||
'应急',
|
|
||||||
'过期',
|
|
||||||
'Bandwidth',
|
|
||||||
'expire',
|
|
||||||
];
|
|
||||||
return {
|
return {
|
||||||
name: 'Useless Filter',
|
name: 'Useless Filter',
|
||||||
func: RegexFilter({
|
func: (proxies) => {
|
||||||
regex: KEYWORDS,
|
return proxies.map((proxy) => {
|
||||||
keep: false,
|
if (proxy.cipher && !isAscii(proxy.cipher)) {
|
||||||
}).func,
|
return false;
|
||||||
|
} else if (proxy.password && !isAscii(proxy.password)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (proxy.network) {
|
||||||
|
let transportHosts =
|
||||||
|
proxy[`${proxy.network}-opts`]?.headers?.Host ||
|
||||||
|
proxy[`${proxy.network}-opts`]?.headers?.host;
|
||||||
|
transportHosts = Array.isArray(transportHosts)
|
||||||
|
? transportHosts
|
||||||
|
: [transportHosts];
|
||||||
|
if (
|
||||||
|
transportHosts.some(
|
||||||
|
(host) => host && !isAscii(host),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !/网址|流量|时间|应急|过期|Bandwidth|expire/.test(
|
||||||
|
proxy.name,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user