Skip to content

Commit f523002

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

14 files changed

Lines changed: 1256 additions & 643 deletions

File tree

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.30.0",
3+
"version": "2.31.0",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"packageManager": "pnpm@11.0.9",

backend/src/core/proxy-utils/processors/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import $ from '@/core/app';
99
import { hex_md5 } from '@/vendor/md5';
1010
import { ProxyUtils } from '@/core/proxy-utils';
1111
import { produceArtifact } from '@/restful/sync';
12+
import { isMihomoConfigFile } from '@/utils/file-type';
1213
import { SETTINGS_KEY } from '@/constants';
1314
import YAML from '@/utils/yaml';
1415

@@ -397,7 +398,7 @@ function ScriptOperator(
397398
name: 'Script Operator',
398399
func: async (proxies) => {
399400
let output = proxies;
400-
if (output?.$file?.type === 'mihomoProfile') {
401+
if (isMihomoConfigFile(output?.$file)) {
401402
try {
402403
let patch = YAML.safeLoad(script);
403404
let config;
@@ -438,7 +439,7 @@ function ScriptOperator(
438439
`async function operator(input = [], targetPlatform, context) {
439440
if (input && (input.$files || input.$content)) {
440441
let { $content, $files, $options, $file } = input
441-
if($file.type === 'mihomoProfile') {
442+
if (['mihomoConfig', 'mihomoProfile'].includes($file?.type)) {
442443
${script}
443444
if(typeof main === 'function') {
444445
let config;
@@ -496,7 +497,7 @@ function AddProxiesFromSubscriptionOperator({
496497
position = 'replace',
497498
} = {}) {
498499
const apply = async (input) => {
499-
if (input?.$file?.type !== 'mihomoProfile') return input;
500+
if (!isMihomoConfigFile(input?.$file)) return input;
500501

501502
const config = normalizeMihomoConfig(input.$content);
502503
const currentProxies = getMihomoProfileProxies(config);

backend/src/core/proxy-utils/producers/clashmeta.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ export default function ClashMeta_Producer() {
5757

5858
if (proxy.type === 'h2-connect') {
5959
$.error(
60-
`Mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${proxy.name} has been filtered.`,
60+
`mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${proxy.name} has been filtered.`,
6161
);
6262
return false;
6363
}
6464
if (hasRootHeaders(proxy) && proxy.type === 'trusttunnel') {
6565
$.error(
66-
`Mihomo does not support headers for TrustTunnel proxy ${proxy.name}. Proxy has been filtered.`,
66+
`mihomo does not support headers for TrustTunnel proxy ${proxy.name}. Proxy has been filtered.`,
6767
);
6868
return false;
6969
}

backend/src/core/proxy-utils/producers/surgemac.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function SurgeMac_Producer() {
3232
throw e;
3333
}
3434
$.log(
35-
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
35+
`${proxy.name} is not supported on ${targetPlatform}, try to use mihomo(SurgeMac - External Proxy Program) instead`,
3636
);
3737
return output;
3838
}

backend/src/products/cron-sync-artifacts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ async function doSync(arg = {}, { canUpload = true } = {}) {
194194

195195
if (useMihomoExternal) {
196196
$.info(
197-
`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`,
197+
`手动指定了 target 为 SurgeMac, 将使用 mihomo External`,
198198
);
199199
}
200200
const output = await produceSyncArtifactOutput(

backend/src/restful/download.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,17 @@ async function downloadSubscription(req, res) {
262262
$.info(`指定输出易读 YAML: ${prettyYaml}`);
263263
}
264264
if (mihomoMerge) {
265-
$.info(`指定合并 Mihomo External: ${mihomoMerge}`);
265+
$.info(`指定合并 mihomo External: ${mihomoMerge}`);
266266
}
267267
if (mihomoMergeName) {
268-
$.info(`指定合并 Mihomo External 名称: ${mihomoMergeName}`);
268+
$.info(`指定合并 mihomo External 名称: ${mihomoMergeName}`);
269269
}
270270

271271
if (useMihomoExternal) {
272-
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
272+
$.info(`手动指定了 target 为 SurgeMac, 将使用 mihomo External`);
273273
}
274274
if (mihomoExternal) {
275-
$.info(`手动指定了 Mihomo External 链接参数: ${mihomoExternal}`);
275+
$.info(`手动指定了 mihomo External 链接参数: ${mihomoExternal}`);
276276
}
277277

278278
if (noCache) {
@@ -610,17 +610,17 @@ async function downloadCollection(req, res) {
610610
$.info(`指定输出易读 YAML: ${prettyYaml}`);
611611
}
612612
if (mihomoMerge) {
613-
$.info(`指定合并 Mihomo External: ${mihomoMerge}`);
613+
$.info(`指定合并 mihomo External: ${mihomoMerge}`);
614614
}
615615
if (mihomoMergeName) {
616-
$.info(`指定合并 Mihomo External 名称: ${mihomoMergeName}`);
616+
$.info(`指定合并 mihomo External 名称: ${mihomoMergeName}`);
617617
}
618618

619619
if (useMihomoExternal) {
620-
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
620+
$.info(`手动指定了 target 为 SurgeMac, 将使用 mihomo External`);
621621
}
622622
if (mihomoExternal) {
623-
$.info(`手动指定了 Mihomo External 链接参数: ${mihomoExternal}`);
623+
$.info(`手动指定了 mihomo External 链接参数: ${mihomoExternal}`);
624624
}
625625
if (noCache) {
626626
$.info(`指定不使用缓存: ${noCache}`);

0 commit comments

Comments
 (0)