Compare commits

...
2 Commits
Author SHA1 Message Date
jinghui 18953ebc9a fix: /filter 页数据不显示(reset时未追加arr) (fixed117)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s
2026-11-10 15:56:52 +08:00
jinghui 566ee297d9 perf: /api/tvbox/all 增加60s进程内响应缓存,栏目秒开 (fixed110)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s
2026-11-10 14:57:12 +08:00
3 changed files with 20 additions and 3 deletions

No files matched your search

+2 -2
View File
@@ -35,7 +35,7 @@ RUN find ./src -type f -name "route.ts" -print0 \
ENV DOCKER_ENV=true
# 海报走站内 /api/image-proxy(浏览器直连豆瓣图被拦导致全裂)
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
ENV NEXT_PUBLIC_SITE_VERSION=fixed109
ENV NEXT_PUBLIC_SITE_VERSION=fixed117
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
# For Docker builds, force dynamic rendering to read runtime environment variables.
@@ -56,7 +56,7 @@ ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV DOCKER_ENV=true
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
ENV NEXT_PUBLIC_SITE_VERSION=fixed109
ENV NEXT_PUBLIC_SITE_VERSION=fixed117
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
# 从构建器中复制 standalone 输出
+11
View File
@@ -152,10 +152,21 @@ async function aggregateAll(sources: SrcCfg[], sp: URLSearchParams) {
return out;
}
// 进程内响应缓存:相同查询 60s 内直接返回,避免每次刷新都重新聚合上游(最新港剧等栏目秒开)
const respCache = new Map<string, [number, any]>();
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const cacheKey = searchParams.toString();
const now = Date.now();
const c = respCache.get(cacheKey);
if (c && now - c[0] < 60000) {
return NextResponse.json(c[1], { headers: { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=60', 'X-Cache': 'HIT' } });
}
const config = await getConfig();
const sourceConfigs: SrcCfg[] = (config.SourceConfig || []).filter((s: any) => !s.disabled);
const r = await aggregateAll(sourceConfigs, searchParams);
respCache.set(cacheKey, [now, r]);
// 防止缓存无限增长:超过 200 条清空
if (respCache.size > 200) respCache.clear();
return NextResponse.json(r, { headers: { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=60' } });
}
+7 -1
View File
@@ -200,7 +200,7 @@ function FilterClient() {
}
const arr: Item[] = Array.isArray(j?.list) ? j.list : [];
setItems((prev) => {
const base = reset ? [] : [...prev, ...arr];
const base = reset ? [...arr] : [...prev, ...arr];
const seen = new Set<string>();
return base.filter((x) => {
const k = x.title + '|' + x.year;
@@ -231,6 +231,12 @@ function FilterClient() {
load(1, true);
}, [source, cat, area, year]);
// 兜底:首次挂载确保加载一次(避免条件 effect 漏触发)
useEffect(() => {
load(1, true);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// 分页:上一页/下一页
const goPage = (pg: number) => {
if (pg < 1) return;