From 8c98f39824bf66222cc0b7c6359749b8be0ee40e Mon Sep 17 00:00:00 2001 From: xream Date: Fri, 10 Apr 2026 17:40:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=AE=A2=E9=98=85/?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BA=A7=E5=88=AB=E7=9A=84=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=BC=93=E5=AD=98=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/utils/download.js | 17 +++++++++++++++-- backend/src/utils/flow.js | 8 +++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/backend/package.json b/backend/package.json index dd6c7992..cda40119 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.21.86", + "version": "2.21.87", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/utils/download.js b/backend/src/utils/download.js index edce833a..d7d475d5 100644 --- a/backend/src/utils/download.js +++ b/backend/src/utils/download.js @@ -304,7 +304,13 @@ export default async function download( if (headers) { const flowInfo = getFlowField(headers); if (flowInfo) { - headersResourceCache.set(id, flowInfo); + headersResourceCache.set( + id, + flowInfo, + $arguments?.headersCacheTtl + ? $arguments?.headersCacheTtl * 1000 + : undefined, + ); } } if (body.replace(/\s/g, '').length === 0) @@ -345,7 +351,14 @@ export default async function download( } } if (shouldCache) { - resourceCache.set(id, body); + console.log($arguments); + resourceCache.set( + id, + body, + $arguments?.cacheTtl + ? $arguments?.cacheTtl * 1000 + : undefined, + ); if (customCacheKey) { $.info( `URL ${url}\n写入自定义缓存 ${$arguments?.cacheKey}`, diff --git a/backend/src/utils/flow.js b/backend/src/utils/flow.js index aaca8130..3b605407 100644 --- a/backend/src/utils/flow.js +++ b/backend/src/utils/flow.js @@ -226,7 +226,13 @@ export async function getFlowHeaders( flowInfo = flowInfo.trim(); } if (flowInfo) { - headersResourceCache.set(id, flowInfo); + headersResourceCache.set( + id, + flowInfo, + $arguments?.headersCacheTtl + ? $arguments?.headersCacheTtl * 1000 + : undefined, + ); } }