feat: 更新搜索API的响应,添加缓存控制头以优化性能

This commit is contained in:
katelya
2025-09-05 01:37:53 +08:00
parent c484dde326
commit 427056f4ad
3 changed files with 25 additions and 9 deletions
+9 -1
View File
@@ -50,10 +50,18 @@ export async function GET(request: Request) {
const regularSites = await getAvailableApiSites();
if (!regularSites || regularSites.length === 0) {
return Response.json({
const cacheTime = await getCacheTime();
const response = NextResponse.json({
regular_results: [],
adult_results: []
}, {
headers: {
'Cache-Control': `public, max-age=${cacheTime}, s-maxage=${cacheTime}`,
'CDN-Cache-Control': `public, s-maxage=${cacheTime}`,
'Vercel-CDN-Cache-Control': `public, s-maxage=${cacheTime}`,
},
});
return addCorsHeaders(response);
}
// 搜索常规(非成人)内容