Compare commits

...

5 Commits

Author SHA1 Message Date
xream
be25919d81 feat: geo 更新 2024-11-30 12:59:49 +08:00
xream
5b28e1a4c9 feat: 支持禁用节点操作 2024-11-29 21:03:29 +08:00
xream
8d0a71d983 feat: VMess URI 输出支持 alterId; Trojan 支持 fp 和 alpn 2024-11-28 16:04:52 +08:00
xream
815552d470 feat: 找不到资源时不通知, 仅保留日志 2024-11-28 15:44:55 +08:00
xream
9d90369594 feat: Trojan URI 支持省略端口号 2024-11-28 13:15:22 +08:00
9 changed files with 56 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.428",
"version": "2.14.433",
"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

@@ -842,6 +842,11 @@ function URI_Trojan() {
};
const parse = (line) => {
const matched = /^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(line);
const port = matched?.[2];
if (!port) {
line = line.replace(matched[1], `${matched[1]}:443`);
}
let [newLine, name] = line.split(/#(.+)/, 2);
const parser = getTrojanURIParser();
const proxy = parser.parse(newLine);

View File

@@ -82,6 +82,8 @@ port = digits:[0-9]+ {
params = "?" head:param tail:("&"@param)* {
proxy["skip-cert-verify"] = toBool(params["allowInsecure"]);
proxy.sni = params["sni"] || params["peer"];
proxy['client-fingerprint'] = params.fp;
proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined;
if (toBool(params["ws"])) {
proxy.network = "ws";

View File

@@ -80,6 +80,8 @@ port = digits:[0-9]+ {
params = "?" head:param tail:("&"@param)* {
proxy["skip-cert-verify"] = toBool(params["allowInsecure"]);
proxy.sni = params["sni"] || params["peer"];
proxy['client-fingerprint'] = params.fp;
proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined;
if (toBool(params["ws"])) {
proxy.network = "ws";

View File

@@ -102,7 +102,7 @@ export default function URI_Producer() {
port: proxy.port,
id: proxy.uuid,
type,
aid: 0,
aid: proxy.alterId || 0,
net,
tls: proxy.tls ? 'tls' : '',
};
@@ -290,11 +290,27 @@ export default function URI_Producer() {
)}`;
}
}
let trojanFp = '';
if (proxy['client-fingerprint']) {
trojanFp = `&fp=${encodeURIComponent(
proxy['client-fingerprint'],
)}`;
}
let trojanAlpn = '';
if (proxy.alpn) {
trojanAlpn = `&alpn=${encodeURIComponent(
Array.isArray(proxy.alpn)
? proxy.alpn
: proxy.alpn.join(','),
)}`;
}
result = `trojan://${proxy.password}@${proxy.server}:${
proxy.port
}?sni=${encodeURIComponent(proxy.sni || proxy.server)}${
proxy['skip-cert-verify'] ? '&allowInsecure=1' : ''
}${trojanTransport}#${encodeURIComponent(proxy.name)}`;
}${trojanTransport}${trojanAlpn}${trojanFp}#${encodeURIComponent(
proxy.name,
)}`;
break;
case 'hysteria2':
let hysteria2params = [];

View File

@@ -255,7 +255,7 @@ async function downloadSubscription(req, res) {
);
}
} else {
$.notify(`🌍 Sub-Store 下载订阅失败`, `❌ 未找到订阅:${name}`);
$.error(`🌍 Sub-Store 下载订阅失败`, `❌ 未找到订阅:${name}`);
failed(
res,
new ResourceNotFoundError(
@@ -457,7 +457,7 @@ async function downloadCollection(req, res) {
);
}
} else {
$.notify(
$.error(
`🌍 Sub-Store 下载组合订阅失败`,
`❌ 未找到组合订阅:${name}`,
);

View File

@@ -179,7 +179,7 @@ async function getFile(req, res) {
);
}
} else {
$.notify(`🌍 Sub-Store 下载文件失败`, `❌ 未找到文件:${name}`);
$.error(`🌍 Sub-Store 下载文件失败`, `❌ 未找到文件:${name}`);
failed(
res,
new ResourceNotFoundError(

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', '新西兰', '新西蘭'],
@@ -294,7 +302,7 @@ export function getFlag(name) {
'Moscow',
],
'🇸🇦': ['Saudi', '沙特阿拉伯', '沙特', 'Riyadh', '利雅得'],
'🇸🇪': ['Sweden', '瑞典'],
'🇸🇪': ['Sweden', '瑞典', '斯德哥尔摩', 'Stockholm'],
'🇸🇬': [
'Singapore',
'新加坡',
@@ -341,6 +349,7 @@ export function getFlag(name) {
'波特兰',
'达拉斯',
'俄勒冈',
'Oregon',
'凤凰城',
'费利蒙',
'硅谷',
@@ -354,10 +363,13 @@ export function getFlag(name) {
'沪美',
'哥伦布',
'纽约',
'New York',
'Los Angeles',
'San Jose',
'Sillicon Valley',
'Michigan',
'俄亥俄',
'Ohio',
],
'🇺🇾': ['Uruguay', '乌拉圭'],
'🇻🇪': ['Venezuela', '委内瑞拉'],