diff --git a/backend/package.json b/backend/package.json index 61ac8a2..b83f9a7 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.244", + "version": "2.14.245", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js index 10d9293..fc70ef6 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -370,6 +370,10 @@ function lastParse(proxy) { delete proxy.ports; } if (['vless'].includes(proxy.type)) { + // 非 reality, 空 flow 没有意义 + if (!proxy['reality-opts'] && !proxy.flow) { + delete proxy.flow; + } if (['http'].includes(proxy.network)) { let transportPath = proxy[`${proxy.network}-opts`]?.path; if (!transportPath) { diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index ab1a768..9e8c2cc 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -444,6 +444,7 @@ function URI_VLESS() { proxy[`${params.security}-opts`] = opts; } } + proxy.network = params.type; if (proxy.network === 'tcp' && params.headerType === 'http') { proxy.network = 'http'; diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index 534168a..fc98604 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -35,13 +35,21 @@ async function produceArtifact({ ignoreFailedRemoteFile, produceType, produceOpts = {}, + subscription, }) { platform = platform || 'JSON'; if (type === 'subscription') { - const allSubs = $.read(SUBS_KEY); - const sub = findByName(allSubs, name); - if (!sub) throw new Error(`找不到订阅 ${name}`); + let sub; + if (name) { + const allSubs = $.read(SUBS_KEY); + sub = findByName(allSubs, name); + if (!sub) throw new Error(`找不到订阅 ${name}`); + } else if (subscription) { + sub = subscription; + } else { + throw new Error('未提供订阅名称或订阅数据'); + } let raw; if (content && !['localFirst', 'remoteFirst'].includes(mergeSources)) { raw = content;