feat: fix /api/search/resources endpoints

This commit is contained in:
shinya
2025-08-14 21:10:56 +08:00
parent f99f0225b3
commit ec6562bf06

View File

@@ -1,23 +1,16 @@
import { NextResponse } from 'next/server';
import { NextRequest, NextResponse } from 'next/server';
import { getAvailableApiSites, getCacheTime } from '@/lib/config';
export const runtime = 'edge';
// OrionTV 兼容接口
export async function GET() {
export async function GET(request: NextRequest) {
console.log('request', request.url);
try {
const apiSites = await getAvailableApiSites();
const cacheTime = await getCacheTime();
return NextResponse.json(apiSites, {
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}`,
'Netlify-Vary': 'query',
},
});
return NextResponse.json(apiSites);
} catch (error) {
return NextResponse.json({ error: '获取资源失败' }, { status: 500 });
}