feat: 更新搜索API的响应,添加缓存控制头以优化性能
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
// 搜索常规(非成人)内容
|
||||
|
||||
Reference in New Issue
Block a user