mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-13 07:57:29 +08:00
feat: fix /api/search/resources endpoints
This commit is contained in:
@@ -1,23 +1,16 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
|
||||||
import { getAvailableApiSites, getCacheTime } from '@/lib/config';
|
import { getAvailableApiSites, getCacheTime } from '@/lib/config';
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
// OrionTV 兼容接口
|
// OrionTV 兼容接口
|
||||||
export async function GET() {
|
export async function GET(request: NextRequest) {
|
||||||
|
console.log('request', request.url);
|
||||||
try {
|
try {
|
||||||
const apiSites = await getAvailableApiSites();
|
const apiSites = await getAvailableApiSites();
|
||||||
const cacheTime = await getCacheTime();
|
|
||||||
|
|
||||||
return NextResponse.json(apiSites, {
|
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',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return NextResponse.json({ error: '获取资源失败' }, { status: 500 });
|
return NextResponse.json({ error: '获取资源失败' }, { status: 500 });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user