diff --git a/backend/package.json b/backend/package.json index 36c99ac..899d31d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.390", + "version": "2.14.391", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/download.js b/backend/src/restful/download.js index 41a70fc..bb24f97 100644 --- a/backend/src/restful/download.js +++ b/backend/src/restful/download.js @@ -181,7 +181,7 @@ async function downloadSubscription(req, res) { url, $arguments.flowUserAgent, undefined, - sub.proxy, + proxy || sub.proxy, $arguments.flowUrl, ); if (flowInfo) { @@ -368,7 +368,7 @@ async function downloadCollection(req, res) { url, $arguments.flowUserAgent, undefined, - sub.proxy || collection.proxy || proxy, + proxy || sub.proxy || collection.proxy, $arguments.flowUrl, ); if (flowInfo) { diff --git a/backend/src/restful/file.js b/backend/src/restful/file.js index ff879f1..bef2871 100644 --- a/backend/src/restful/file.js +++ b/backend/src/restful/file.js @@ -59,6 +59,7 @@ async function getFile(req, res) { content, mergeSources, ignoreFailedRemoteFile, + proxy, } = req.query; let $options = {}; if (req.query.$options) { @@ -82,6 +83,10 @@ async function getFile(req, res) { url = decodeURIComponent(url); $.info(`指定远程文件 URL: ${url}`); } + if (proxy) { + proxy = decodeURIComponent(proxy); + $.info(`指定远程订阅使用代理/策略 proxy: ${proxy}`); + } if (ua) { ua = decodeURIComponent(ua); $.info(`指定远程文件 User-Agent: ${ua}`); @@ -120,6 +125,7 @@ async function getFile(req, res) { mergeSources, ignoreFailedRemoteFile, $options, + proxy, }); try { @@ -129,6 +135,8 @@ async function getFile(req, res) { const flowInfo = await getFlowHeaders( subInfoUrl, subInfoUserAgent || file.subInfoUserAgent, + undefined, + proxy || file.proxy, ); if (flowInfo) { res.set('subscription-userinfo', flowInfo); diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index 63e559b..03a9e28 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -69,7 +69,7 @@ async function produceArtifact({ url, ua || sub.ua, undefined, - sub.proxy || proxy, + proxy || sub.proxy, undefined, awaitCustomCache, ); @@ -116,7 +116,7 @@ async function produceArtifact({ url, ua || sub.ua, undefined, - sub.proxy || proxy, + proxy || sub.proxy, undefined, awaitCustomCache, ); @@ -221,9 +221,9 @@ async function produceArtifact({ url, sub.ua, undefined, - sub.proxy || - collection.proxy || - proxy, + proxy || + sub.proxy || + collection.proxy, ); } catch (err) { errors[url] = err; @@ -392,7 +392,12 @@ async function produceArtifact({ .filter((i) => i.length) .map(async (url) => { try { - return await download(url, ua || file.ua); + return await download( + url, + ua || file.ua, + undefined, + file.proxy || proxy, + ); } catch (err) { errors[url] = err; $.error( @@ -435,7 +440,12 @@ async function produceArtifact({ .filter((i) => i.length) .map(async (url) => { try { - return await download(url, ua || file.ua); + return await download( + url, + ua || file.ua, + undefined, + file.proxy || proxy, + ); } catch (err) { errors[url] = err; $.error(