feat(wip): 支持 SurgeMac 下载参数透传并增强 Mihomo External 合并行为

- 下载接口新增 SurgeMac 专属参数提取方法,统一处理 `mihomoMerge / mihomoMergeName / mihomoExternal`
- `downloadSubscription` 与 `downloadCollection` 都透传这些参数到生成配置逻辑,且保留现有默认行为
- SurgeMac 生产器支持通过 `opts.mihomoExternal` 控制 mihomo 输出,并在 fallback 场景下安全返回空字符串兜底
- `SurgeMac` 日志增加 `mihomoMerge / mihomoMergeName / mihomoExternal` 可观测输出,排障更清晰
- 新增下载路由测试:单订阅与组合订阅下的默认/合并/链接参数场景覆盖
This commit is contained in:
xream committed 2026-05-15 13:25:21 +08:00
1 parent b485234128
commit 106b3a8a50
3 files changed
+271 -41

No files matched your search

@@ -11,15 +11,15 @@ const surge_Producer = Surge_Producer();
export default function SurgeMac_Producer() {
const produce = (proxy, type, opts = {}) => {
if (proxy._mihomoExternal) {
return mihomo(proxy, type, opts);
}
switch (proxy.type) {
case 'external':
return external(proxy);
// case 'ssr':
// return shadowsocksr(proxy);
default: {
if (opts.mihomoExternal || proxy._mihomoExternal) {
return mihomo(proxy, type, opts) || '';
}
try {
return surge_Producer.produce(proxy, type, opts);
} catch (e) {
@@ -27,7 +27,7 @@ export default function SurgeMac_Producer() {
opts.useMihomoExternal &&
e instanceof SurgeUnsupportedProxyError
) {
const output = mihomo(proxy, type, opts);
const output = mihomo(proxy, type, opts) || '';
if (!output) {
throw e;
}