Compare commits

...

5 Commits

Author SHA1 Message Date
xream
dbf9e7c360 feat: 优化去除无效节点逻辑 感谢群友 Cooip JM 2024-12-05 12:45:07 +08:00
xream
4ea84118c4 feat: gRPC 支持 authority 2024-12-05 00:52:11 +08:00
xream
dda8113a42 feat: 增加 subscription-userinfo 兼容性 2024-12-04 00:56:53 +08:00
xream
f16b2d34f1 feat: geo 更新 2024-11-30 13:58:04 +08:00
xream
5b28e1a4c9 feat: 支持禁用节点操作 2024-11-29 21:03:29 +08:00
13 changed files with 101 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.431",
"version": "2.14.436",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@@ -86,6 +86,16 @@ async function processFn(
$options,
) {
for (const item of operators) {
if (item.disabled) {
$.log(
`Skipping disabled operator: "${
item.type
}" with arguments:\n >>> ${
JSON.stringify(item.args, null, 2) || 'None'
}`,
);
continue;
}
// process script
let script;
let $arguments = {};

View File

@@ -380,6 +380,7 @@ function URI_VMess() {
proxy[`${proxy.network}-opts`] = {
'grpc-service-name': getIfNotBlank(transportPath),
'_grpc-type': getIfNotBlank(params.type),
'_grpc-authority': getIfNotBlank(params.authority),
};
} else {
const opts = {
@@ -515,6 +516,9 @@ function URI_VLESS() {
}
if (params.serviceName) {
opts[`${proxy.network}-service-name`] = params.serviceName;
if (['grpc'].includes(proxy.network) && params.authority) {
opts['_grpc-authority'] = params.authority;
}
} else if (isShadowrocket && params.path) {
if (!['ws', 'http', 'h2'].includes(proxy.network)) {
opts[`${proxy.network}-service-name`] = params.path;

View File

@@ -101,6 +101,7 @@ params = "?" head:param tail:("&"@param)* {
proxy[proxy.network + '-opts'] = {
'grpc-service-name': params["serviceName"],
'_grpc-type': params["mode"],
'_grpc-authority': params["authority"],
};
} else {
if (params["path"]) {

View File

@@ -99,6 +99,7 @@ params = "?" head:param tail:("&"@param)* {
proxy[proxy.network + '-opts'] = {
'grpc-service-name': params["serviceName"],
'_grpc-type': params["mode"],
'_grpc-authority': params["authority"],
};
} else {
if (params["path"]) {

View File

@@ -699,24 +699,45 @@ function isIP(ip) {
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 ***************************************/
// filter useless proxies
function UselessFilter() {
const KEYWORDS = [
'网址',
'流量',
'时间',
'应急',
'过期',
'Bandwidth',
'expire',
];
return {
name: 'Useless Filter',
func: RegexFilter({
regex: KEYWORDS,
keep: false,
}).func,
func: (proxies) => {
return proxies.map((proxy) => {
if (proxy.cipher && !isAscii(proxy.cipher)) {
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,
);
}
});
},
};
}

View File

@@ -175,6 +175,7 @@ export default function Clash_Producer() {
proxy[`${proxy.network}-opts`]
) {
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
}
return proxy;
});

View File

@@ -190,6 +190,7 @@ export default function ClashMeta_Producer() {
proxy[`${proxy.network}-opts`]
) {
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
}
return proxy;
});

View File

@@ -193,6 +193,7 @@ export default function ShadowRocket_Producer() {
proxy[`${proxy.network}-opts`]
) {
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
}
return proxy;
});

View File

@@ -289,6 +289,7 @@ export default function Stash_Producer() {
proxy[`${proxy.network}-opts`]
) {
delete proxy[`${proxy.network}-opts`]['_grpc-type'];
delete proxy[`${proxy.network}-opts`]['_grpc-authority'];
}
return proxy;
});

View File

@@ -134,6 +134,8 @@ export default function URI_Producer() {
result.type =
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
'gun';
result.host =
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
}
}
result = 'vmess://' + Base64.encode(JSON.stringify(result));
@@ -196,6 +198,13 @@ export default function URI_Producer() {
vlessTransport += `&mode=${encodeURIComponent(
proxy[`${proxy.network}-opts`]?.['_grpc-type'] || 'gun',
)}`;
const authority =
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
if (authority) {
vlessTransport += `&authority=${encodeURIComponent(
authority,
)}`;
}
}
let vlessTransportServiceName =
@@ -261,11 +270,18 @@ export default function URI_Producer() {
proxy[`${proxy.network}-opts`]?.[
`${proxy.network}-service-name`
];
let trojanTransportAuthority =
proxy[`${proxy.network}-opts`]?.['_grpc-authority'];
if (trojanTransportServiceName) {
trojanTransport += `&serviceName=${encodeURIComponent(
trojanTransportServiceName,
)}`;
}
if (trojanTransportAuthority) {
trojanTransport += `&authority=${encodeURIComponent(
trojanTransportAuthority,
)}`;
}
trojanTransport += `&mode=${encodeURIComponent(
proxy[`${proxy.network}-opts`]?.['_grpc-type'] ||
'gun',

View File

@@ -18,7 +18,9 @@ export function getFlowField(headers) {
}
}
return `${sub || ''}${webPage ? `;app_url=${webPage}` : ''}`;
return `${sub || ''}${
webPage ? `; app_url=${encodeURIComponent(webPage)}` : ''
}`;
}
export async function getFlowHeaders(
rawUrl,

View File

@@ -151,6 +151,7 @@ export function getFlag(name) {
'滑铁卢',
'多伦多',
'Waterloo',
'Toronto',
],
'🇨🇭': ['Switzerland', '瑞士', '苏黎世', 'Zurich'],
'🇨🇱': ['Chile', '智利'],
@@ -245,7 +246,7 @@ export function getFlag(name) {
'🇮🇪': ['Ireland', '爱尔兰', '愛爾蘭', '都柏林'],
'🇮🇱': ['Israel', '以色列'],
'🇮🇲': ['Isle of Man', '马恩岛', '馬恩島'],
'🇮🇳': ['India', '印度', '孟买', 'MFumbai'],
'🇮🇳': ['India', '印度', '孟买', 'MFumbai', 'Mumbai'],
'🇮🇷': ['Iran', '伊朗'],
'🇮🇸': ['Iceland', '冰岛', '冰島'],
'🇮🇹': ['Italy', '意大利', '義大利', '米兰', 'Nachash'],
@@ -261,7 +262,14 @@ export function getFlag(name) {
'🇲🇹': ['Malta', '马耳他'],
'🇲🇽': ['Mexico', '墨西哥'],
'🇲🇾': ['Malaysia', '马来', '馬來', '吉隆坡', '大馬'],
'🇳🇱': ['Netherlands', '荷兰', '荷蘭', '尼德蘭', '阿姆斯特丹'],
'🇳🇱': [
'Netherlands',
'荷兰',
'荷蘭',
'尼德蘭',
'阿姆斯特丹',
'Amsterdam',
],
'🇳🇴': ['Norway', '挪威'],
'🇳🇵': ['Nepal', '尼泊尔'],
'🇳🇿': ['New Zealand', '新西兰', '新西蘭'],
@@ -269,7 +277,7 @@ export function getFlag(name) {
'🇵🇪': ['Peru', '秘鲁', '祕魯'],
'🇵🇭': ['Philippines', '菲律宾', '菲律賓'],
'🇵🇰': ['Pakistan', '巴基斯坦'],
'🇵🇱': ['Poland', '波兰', '波蘭'],
'🇵🇱': ['Poland', '波兰', '波蘭', '华沙', 'Warsaw'],
'🇵🇷': ['Puerto Rico', '波多黎各'],
'🇵🇹': ['Portugal', '葡萄牙'],
'🇵🇾': ['Paraguay', '巴拉圭'],
@@ -294,7 +302,7 @@ export function getFlag(name) {
'Moscow',
],
'🇸🇦': ['Saudi', '沙特阿拉伯', '沙特', 'Riyadh', '利雅得'],
'🇸🇪': ['Sweden', '瑞典'],
'🇸🇪': ['Sweden', '瑞典', '斯德哥尔摩', 'Stockholm'],
'🇸🇬': [
'Singapore',
'新加坡',
@@ -314,7 +322,7 @@ export function getFlag(name) {
'🇸🇰': ['Slovakia', '斯洛伐克'],
'🇹🇭': ['Thailand', '泰国', '泰國', '曼谷'],
'🇹🇳': ['Tunisia', '突尼斯'],
'🇹🇷': ['Turkey', '土耳其', '伊斯坦布尔'],
'🇹🇷': ['Turkey', '土耳其', '伊斯坦布尔', 'Istanbul'],
'🇹🇼': [
'Taiwan',
'台湾',
@@ -341,6 +349,7 @@ export function getFlag(name) {
'波特兰',
'达拉斯',
'俄勒冈',
'Oregon',
'凤凰城',
'费利蒙',
'硅谷',
@@ -354,10 +363,17 @@ export function getFlag(name) {
'沪美',
'哥伦布',
'纽约',
'New York',
'Los Angeles',
'San Jose',
'Sillicon Valley',
'Michigan',
'俄亥俄',
'Ohio',
'马纳萨斯',
'Manassas',
'弗吉尼亚',
'Virginia',
],
'🇺🇾': ['Uruguay', '乌拉圭'],
'🇻🇪': ['Venezuela', '委内瑞拉'],
@@ -418,8 +434,12 @@ export function getFlag(name) {
RegExp(`(^|[^a-zA-Z])${keyword}([^a-zA-Z]|$)`).test(name),
)
) {
//console.log(`ISOFlag = ${flag}`)
return (Flag = flag);
const isCN2 =
flag == '🇨🇳' &&
RegExp(`(^|[^a-zA-Z])CN2([^a-zA-Z]|$)`).test(name);
if (!isCN2) {
return (Flag = flag);
}
}
}