diff --git a/backend/package.json b/backend/package.json index d338e94..06e8fcc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.414", + "version": "2.14.415", "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 8664170..168ed32 100644 --- a/backend/src/restful/download.js +++ b/backend/src/restful/download.js @@ -75,6 +75,7 @@ async function downloadSubscription(req, res) { includeUnsupportedProxy, resultFormat, proxy, + noCache, } = req.query; let $options = {}; if (req.query.$options) { @@ -131,6 +132,10 @@ async function downloadSubscription(req, res) { $.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`); } + if (noCache) { + $.info(`指定不使用缓存: ${noCache}`); + } + const allSubs = $.read(SUBS_KEY); const sub = findByName(allSubs, name); if (sub) { @@ -151,6 +156,7 @@ async function downloadSubscription(req, res) { }, $options, proxy, + noCache, }); if ( @@ -283,6 +289,7 @@ async function downloadCollection(req, res) { includeUnsupportedProxy, resultFormat, proxy, + noCache, } = req.query; let $options = {}; @@ -325,6 +332,9 @@ async function downloadCollection(req, res) { if (useMihomoExternal) { $.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`); } + if (noCache) { + $.info(`指定不使用缓存: ${noCache}`); + } if (collection) { try { @@ -340,6 +350,7 @@ async function downloadCollection(req, res) { }, $options, proxy, + noCache, }); // forward flow header from the first subscription in this collection diff --git a/backend/src/restful/sync.js b/backend/src/restful/sync.js index b28057a..d1d193b 100644 --- a/backend/src/restful/sync.js +++ b/backend/src/restful/sync.js @@ -39,6 +39,7 @@ async function produceArtifact({ awaitCustomCache, $options, proxy, + noCache, }) { platform = platform || 'JSON'; @@ -72,6 +73,7 @@ async function produceArtifact({ proxy || sub.proxy, undefined, awaitCustomCache, + noCache, ); } catch (err) { errors[url] = err; @@ -119,6 +121,7 @@ async function produceArtifact({ proxy || sub.proxy, undefined, awaitCustomCache, + noCache, ); } catch (err) { errors[url] = err; @@ -237,6 +240,9 @@ async function produceArtifact({ proxy || sub.proxy || collection.proxy, + undefined, + undefined, + noCache, ); } catch (err) { errors[url] = err; @@ -410,6 +416,9 @@ async function produceArtifact({ ua || file.ua, undefined, file.proxy || proxy, + undefined, + undefined, + noCache, ); } catch (err) { errors[url] = err; @@ -458,6 +467,9 @@ async function produceArtifact({ ua || file.ua, undefined, file.proxy || proxy, + undefined, + undefined, + noCache, ); } catch (err) { errors[url] = err; diff --git a/backend/src/utils/download.js b/backend/src/utils/download.js index 74980a7..c0c8d1e 100644 --- a/backend/src/utils/download.js +++ b/backend/src/utils/download.js @@ -21,6 +21,7 @@ export default async function download( customProxy, skipCustomCache, awaitCustomCache, + noCache, ) { let $arguments = {}; let url = rawUrl.replace(/#noFlow$/, ''); @@ -65,7 +66,7 @@ export default async function download( if (customCacheKey && !skipCustomCache) { const customCached = $.read(customCacheKey); const cached = resourceCache.get(id); - if (!$arguments?.noCache && cached) { + if (!noCache && !$arguments?.noCache && cached) { $.info( `乐观缓存: URL ${url}\n存在有效的常规缓存\n使用常规缓存以避免重复请求`, ); @@ -149,7 +150,7 @@ export default async function download( // try to find in app cache const cached = resourceCache.get(id); - if (!$arguments?.noCache && cached) { + if (!noCache && !$arguments?.noCache && cached) { $.info(`使用缓存: ${url}`); result = cached; if (customCacheKey) {