Compare commits

...

8 Commits

Author SHA1 Message Date
xream
0d5e1ab38b feat: 下载订阅的日志中增加请求 target 和实际输出 2024-12-28 17:42:26 +08:00
xream
a3ec98caa9 feat: Clash 订阅仅缓存 proxies 数据 2024-12-27 21:55:13 +08:00
xream
d9e4d814bb feat: geo 更新 2024-12-27 21:35:51 +08:00
xream
e843aa3702 feat: geo 更新 2024-12-26 03:40:53 +08:00
xream
66464645f2 feat: UDP 协议跳过设置 utls 2024-12-24 21:43:23 +08:00
xream
9ccd6b3816 doc: demo.js 2024-12-24 20:49:41 +08:00
xream
74be1e3d82 doc: README 2024-12-24 15:10:38 +08:00
xream
6d78eb7356 feat: Clash 系输入支持 mieru; 调整 juicity 和 mieru 相关过滤逻辑 2024-12-24 15:08:28 +08:00
14 changed files with 81 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ Core functionalities:
- [x] Loon (SS, SSR, VMess, Trojan, HTTP, SOCKS5, SOCKS5-TLS, WireGuard, VLESS, Hysteria 2)
- [x] Surge (Direct, SS, VMess, Trojan, HTTP, SOCKS5, SOCKS5-TLS, TUIC, Snell, Hysteria 2, SSH(Password authentication only), External Proxy Program(only for macOS), WireGuard(Surge to Surge))
- [x] Surfboard (SS, VMess, Trojan, HTTP, SOCKS5, SOCKS5-TLS, WireGuard(Surfboard to Surfboard))
- [x] Clash.Meta (Direct, SS, SSR, VMess, Trojan, HTTP, SOCKS5, Snell, VLESS, WireGuard, Hysteria, Hysteria 2, TUIC)
- [x] Clash.Meta (Direct, SS, SSR, VMess, Trojan, HTTP, SOCKS5, Snell, VLESS, WireGuard, Hysteria, Hysteria 2, TUIC, SSH, mieru)
- [x] Stash (SS, SSR, VMess, Trojan, HTTP, SOCKS5, Snell, VLESS, WireGuard, Hysteria, TUIC, Juicity, SSH)
- [x] Clash (SS, SSR, VMess, Trojan, HTTP, SOCKS5, Snell, VLESS, WireGuard)

View File

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

View File

@@ -929,6 +929,8 @@ function Clash_All() {
const proxy = JSON.parse(line);
if (
![
'mieru',
'juicity',
'ss',
'ssr',
'vmess',

View File

@@ -8,6 +8,8 @@ export default function ClashMeta_Producer() {
if (opts['include-unsupported-proxy']) return true;
if (proxy.type === 'snell' && String(proxy.version) === '4') {
return false;
} else if (['juicity'].includes(proxy.type)) {
return false;
}
return true;
})

View File

@@ -8,6 +8,8 @@ export default function ShadowRocket_Producer() {
if (opts['include-unsupported-proxy']) return true;
if (proxy.type === 'snell' && String(proxy.version) === '4') {
return false;
} else if (['mieru'].includes(proxy.type)) {
return false;
}
return true;
})

View File

@@ -214,7 +214,11 @@ const tlsParser = (proxy, parsedProxy) => {
proxy['reality-opts']['short-id'];
parsedProxy.tls.utls = { enabled: true };
}
if (proxy['client-fingerprint'] && proxy['client-fingerprint'] !== '')
if (
!['hysteria', 'hysteria2', 'tuic'].includes(proxy.type) &&
proxy['client-fingerprint'] &&
proxy['client-fingerprint'] !== ''
)
parsedProxy.tls.utls = {
enabled: true,
fingerprint: proxy['client-fingerprint'],

View File

@@ -47,7 +47,16 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`);
try {
let raw = await download(resourceUrl, arg?.ua, arg?.timeout);
let raw = await download(
resourceUrl,
arg?.ua,
arg?.timeout,
undefined,
undefined,
undefined,
undefined,
true,
);
let proxies = ProxyUtils.parse(raw);
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
'include-unsupported-proxy': arg?.includeUnsupportedProxy,

View File

@@ -63,7 +63,7 @@ async function downloadSubscription(req, res) {
$.info(
`正在下载订阅:${name}\n请求 User-Agent: ${
req.headers['user-agent'] || req.headers['User-Agent']
}`,
}\n请求 target: ${req.query.target}\n实际输出: ${platform}`,
);
let {
url,
@@ -303,7 +303,7 @@ async function downloadCollection(req, res) {
$.info(
`正在下载组合订阅:${name}\n请求 User-Agent: ${
req.headers['user-agent'] || req.headers['User-Agent']
}`,
}\n请求 target: ${req.query.target}\n实际输出: ${platform}`,
);
let {

View File

@@ -62,6 +62,7 @@ async function getFile(req, res) {
mergeSources,
ignoreFailedRemoteFile,
proxy,
noCache,
} = req.query;
let $options = {};
if (req.query.$options) {
@@ -113,6 +114,9 @@ async function getFile(req, res) {
ignoreFailedRemoteFile = decodeURIComponent(ignoreFailedRemoteFile);
$.info(`指定忽略失败的远程文件: ${ignoreFailedRemoteFile}`);
}
if (noCache) {
$.info(`指定不使用缓存: ${noCache}`);
}
const allFiles = $.read(FILES_KEY);
const file = findByName(allFiles, name);
@@ -128,6 +132,7 @@ async function getFile(req, res) {
ignoreFailedRemoteFile,
$options,
proxy,
noCache,
});
try {

View File

@@ -114,6 +114,10 @@ async function compareSub(req, res) {
sub.ua,
undefined,
sub.proxy,
undefined,
undefined,
undefined,
true,
);
} catch (err) {
errors[url] = err;
@@ -219,6 +223,10 @@ async function compareCollection(req, res) {
sub.ua,
undefined,
sub.proxy,
undefined,
undefined,
undefined,
true,
);
} catch (err) {
errors[url] = err;

View File

@@ -74,6 +74,7 @@ async function produceArtifact({
undefined,
awaitCustomCache,
noCache,
true,
);
} catch (err) {
errors[url] = err;
@@ -122,6 +123,7 @@ async function produceArtifact({
undefined,
awaitCustomCache,
noCache,
true,
);
} catch (err) {
errors[url] = err;
@@ -243,6 +245,7 @@ async function produceArtifact({
undefined,
undefined,
noCache,
true,
);
} catch (err) {
errors[url] = err;

View File

@@ -11,6 +11,10 @@ import {
validCheck,
} from '@/utils/flow';
import $ from '@/core/app';
import PROXY_PREPROCESSORS from '@/core/proxy-utils/preprocessors';
const clashPreprocessor = PROXY_PREPROCESSORS.find(
(processor) => processor.name === 'Clash Pre-processor',
);
const tasks = new Map();
@@ -22,6 +26,7 @@ export default async function download(
skipCustomCache,
awaitCustomCache,
noCache,
preprocess,
) {
let $arguments = {};
let url = rawUrl.replace(/#noFlow$/, '');
@@ -87,6 +92,9 @@ export default async function download(
timeout,
proxy,
true,
undefined,
undefined,
preprocess,
);
} catch (e) {
$.error(
@@ -107,6 +115,9 @@ export default async function download(
timeout,
proxy,
true,
undefined,
undefined,
preprocess,
).catch((e) => {
$.error(
`乐观缓存: URL ${url} 异步更新缓存发生错误 ${
@@ -169,10 +180,10 @@ export default async function download(
: { insecure: true }
: undefined;
$.info(
`Downloading...\nUser-Agent: ${userAgent}\nTimeout: ${requestTimeout}\nProxy: ${proxy}\nInsecure: ${!!insecure}\nURL: ${url}`,
`Downloading...\nUser-Agent: ${userAgent}\nTimeout: ${requestTimeout}\nProxy: ${proxy}\nInsecure: ${!!insecure}\nPreprocess: ${preprocess}\nURL: ${url}`,
);
try {
const { body, headers, statusCode } = await http.get({
let { body, headers, statusCode } = await http.get({
url,
...(proxy ? { proxy } : {}),
...(isLoon && proxy ? { node: proxy } : {}),
@@ -193,6 +204,15 @@ export default async function download(
}
if (body.replace(/\s/g, '').length === 0)
throw new Error(new Error('远程资源内容为空'));
if (preprocess) {
try {
if (clashPreprocessor.test(body)) {
body = clashPreprocessor.parse(body);
}
} catch (e) {
$.error(`Clash Pre-processor error: ${e}`);
}
}
let shouldCache = true;
if (cacheThreshold) {
const size = body.length / 1024;

View File

@@ -17,6 +17,7 @@ const ISOFlags = {
'🇧🇪': ['BE', 'BEL'],
'🇧🇬': ['BG', 'BGR'],
'🇧🇭': ['BH', 'BHR'],
'🇧🇴': ['BO', 'BOL'],
'🇧🇷': ['BR', 'BRA'],
'🇧🇾': ['BY', 'BLR'],
'🇨🇦': ['CA', 'CAN'],
@@ -38,6 +39,7 @@ const ISOFlags = {
'🇬🇧': ['GB', 'GBR', 'UK'],
'🇬🇪': ['GE', 'GEO'],
'🇬🇷': ['GR', 'GRC'],
'🇬🇹': ['GT', 'GTM'],
'🇭🇰': ['HK', 'HKG', 'HKT', 'HKBN', 'HGC', 'WTT', 'CMI'],
'🇭🇷': ['HR', 'HRV'],
'🇭🇺': ['HU', 'HUN'],
@@ -141,6 +143,7 @@ export function getFlag(name) {
'🇧🇭': ['Bahrain', '巴林'],
'🇧🇷': ['Brazil', '巴西', '圣保罗'],
'🇧🇾': ['Belarus', '白俄罗斯', '白俄'],
'🇧🇴': ['Bolivia', '玻利维亚'],
'🇨🇦': [
'Canada',
'加拿大',
@@ -191,6 +194,7 @@ export function getFlag(name) {
],
'🇬🇪': ['Georgia', '格鲁吉亚', '格魯吉亞'],
'🇬🇷': ['Greece', '希腊', '希臘'],
'🇬🇹': ['Guatemala', '危地马拉'],
'🇭🇰': [
'Hongkong',
'香港',

View File

@@ -165,6 +165,20 @@ function operator(proxies = [], targetPlatform, context) {
// 若不存在 `source._collection`, 说明输出结果为单条订阅, 脚本设置在此单条订阅上
// 这个历史遗留原因, 是有点复杂. 提供一个例子, 用来取当前脚本所在的组合订阅或单条订阅名称
// let name = ''
// for (const [key, value] of Object.entries(env.source)) {
// if (!key.startsWith('_')) {
// name = value.displayName || value.name
// break
// }
// }
// if (!name) {
// const collection = env.source._collection
// name = collection.displayName || collection.name
// }
// 1. 输出单条订阅 sub-1 时, 该单条订阅中的脚本上下文为:
// {
// "source": {