feat: 文件 mihomo 配置的来源新增远程/本地, 可作为 mihomo 配置或转换为 mihomo 节点; 文件路由支持参数覆盖

This commit is contained in:
xream committed 2026-06-21 02:19:05 +08:00
1 parent e9625a8844
commit f523002ecb
14 files changed
+1256 -643

No files matched your search

@@ -9,6 +9,7 @@ import $ from '@/core/app';
import { hex_md5 } from '@/vendor/md5';
import { ProxyUtils } from '@/core/proxy-utils';
import { produceArtifact } from '@/restful/sync';
import { isMihomoConfigFile } from '@/utils/file-type';
import { SETTINGS_KEY } from '@/constants';
import YAML from '@/utils/yaml';
@@ -397,7 +398,7 @@ function ScriptOperator(
name: 'Script Operator',
func: async (proxies) => {
let output = proxies;
if (output?.$file?.type === 'mihomoProfile') {
if (isMihomoConfigFile(output?.$file)) {
try {
let patch = YAML.safeLoad(script);
let config;
@@ -438,7 +439,7 @@ function ScriptOperator(
`async function operator(input = [], targetPlatform, context) {
if (input && (input.$files || input.$content)) {
let { $content, $files, $options, $file } = input
if($file.type === 'mihomoProfile') {
if (['mihomoConfig', 'mihomoProfile'].includes($file?.type)) {
${script}
if(typeof main === 'function') {
let config;
@@ -496,7 +497,7 @@ function AddProxiesFromSubscriptionOperator({
position = 'replace',
} = {}) {
const apply = async (input) => {
if (input?.$file?.type !== 'mihomoProfile') return input;
if (!isMihomoConfigFile(input?.$file)) return input;
const config = normalizeMihomoConfig(input.$content);
const currentProxies = getMihomoProfileProxies(config);
@@ -57,13 +57,13 @@ export default function ClashMeta_Producer() {
if (proxy.type === 'h2-connect') {
$.error(
`Mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${proxy.name} has been filtered.`,
`mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${proxy.name} has been filtered.`,
);
return false;
}
if (hasRootHeaders(proxy) && proxy.type === 'trusttunnel') {
$.error(
`Mihomo does not support headers for TrustTunnel proxy ${proxy.name}. Proxy has been filtered.`,
`mihomo does not support headers for TrustTunnel proxy ${proxy.name}. Proxy has been filtered.`,
);
return false;
}
@@ -32,7 +32,7 @@ export default function SurgeMac_Producer() {
throw e;
}
$.log(
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
`${proxy.name} is not supported on ${targetPlatform}, try to use mihomo(SurgeMac - External Proxy Program) instead`,
);
return output;
}