mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-05-18 03:37:28 +08:00
fix: add await
This commit is contained in:
@@ -27,7 +27,7 @@ export async function GET(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await getDetailFromApi(apiSite, id);
|
const result = await getDetailFromApi(apiSite, id);
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
|
|
||||||
return NextResponse.json(result, {
|
return NextResponse.json(result, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export async function GET(request: Request) {
|
|||||||
list: list,
|
list: list,
|
||||||
};
|
};
|
||||||
|
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
return NextResponse.json(response, {
|
return NextResponse.json(response, {
|
||||||
headers: {
|
headers: {
|
||||||
'Cache-Control': `public, max-age=${cacheTime}`,
|
'Cache-Control': `public, max-age=${cacheTime}`,
|
||||||
@@ -180,7 +180,7 @@ function handleTop250(pageStart: number) {
|
|||||||
list: movies,
|
list: movies,
|
||||||
};
|
};
|
||||||
|
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
return NextResponse.json(apiResponse, {
|
return NextResponse.json(apiResponse, {
|
||||||
headers: {
|
headers: {
|
||||||
'Cache-Control': `public, max-age=${cacheTime}`,
|
'Cache-Control': `public, max-age=${cacheTime}`,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export async function GET(request: Request) {
|
|||||||
const resourceId = searchParams.get('resourceId');
|
const resourceId = searchParams.get('resourceId');
|
||||||
|
|
||||||
if (!query || !resourceId) {
|
if (!query || !resourceId) {
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ result: null, error: '缺少必要参数: q 或 resourceId' },
|
{ result: null, error: '缺少必要参数: q 或 resourceId' },
|
||||||
{
|
{
|
||||||
@@ -40,7 +40,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
const results = await searchFromApi(targetSite, query);
|
const results = await searchFromApi(targetSite, query);
|
||||||
const result = results.filter((r) => r.title === query);
|
const result = results.filter((r) => r.title === query);
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
|
|
||||||
if (result.length === 0) {
|
if (result.length === 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ export const runtime = 'edge';
|
|||||||
// OrionTV 兼容接口
|
// OrionTV 兼容接口
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
try {
|
try {
|
||||||
const apiSites = getAvailableApiSites();
|
const apiSites = await getAvailableApiSites();
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
|
|
||||||
return NextResponse.json(apiSites, {
|
return NextResponse.json(apiSites, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export async function GET(request: Request) {
|
|||||||
try {
|
try {
|
||||||
const results = await Promise.all(searchPromises);
|
const results = await Promise.all(searchPromises);
|
||||||
const flattenedResults = results.flat();
|
const flattenedResults = results.flat();
|
||||||
const cacheTime = getCacheTime();
|
const cacheTime = await getCacheTime();
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ results: flattenedResults },
|
{ results: flattenedResults },
|
||||||
|
|||||||
Reference in New Issue
Block a user