feat: 调整生成 mihomo 配置的逻辑, 内容在脚本操作前生成; 文件路由支持 download 参数启用下载(文件名为显示名称)

This commit is contained in:
xream committed 2026-06-20 11:15:17 +08:00
1 parent 4b97309ba1
commit 916ae9841c
7 files changed
+109 -39

No files matched your search

@@ -412,28 +412,7 @@ function ScriptOperator(
if (typeof patch !== 'object')
throw new Error('patch is not an object');
output.$content = ProxyUtils.yaml.safeDump(
deepMerge(
config ||
(output?.$file?.sourceType === 'none'
? {}
: {
proxies: await produceArtifact({
type:
output?.$file?.sourceType ||
'collection',
name: output?.$file?.sourceName,
platform: 'mihomo',
produceType: 'internal',
produceOpts: {
'delete-underscore-fields': true,
'include-unsupported-proxy':
output?.$file
?.includeUnsupportedProxy,
},
}),
}),
patch,
),
deepMerge(config || {}, patch),
);
return output;
} catch (e) {
@@ -470,19 +449,7 @@ function ScriptOperator(
console.log(e.message ?? e);
}
}
$content = ProxyUtils.yaml.safeDump(await main(config || ($file.sourceType === 'none' ? {} : {
proxies: await produceArtifact({
type: $file.sourceType || 'collection',
name: $file.sourceName,
platform: 'mihomo',
produceType: 'internal',
produceOpts: {
'delete-underscore-fields': true,
'include-unsupported-proxy':
$file.includeUnsupportedProxy,
}
}),
})))
$content = ProxyUtils.yaml.safeDump(await main(config || {}))
}
} else {
${script}