diff --git a/src/app/api/openlist/refresh/route.ts b/src/app/api/openlist/refresh/route.ts index 3e771e9..d7fb8c5 100644 --- a/src/app/api/openlist/refresh/route.ts +++ b/src/app/api/openlist/refresh/route.ts @@ -3,6 +3,7 @@ import { NextRequest, NextResponse } from 'next/server'; import { getAuthInfoFromCookie } from '@/lib/auth'; +import { getConfig } from '@/lib/config'; import { startOpenListRefresh } from '@/lib/openlist-refresh'; export const runtime = 'nodejs'; @@ -19,6 +20,15 @@ export async function POST(request: NextRequest) { return NextResponse.json({ error: '未授权' }, { status: 401 }); } + // 检查 TMDB API Key 是否配置 + const config = await getConfig(); + if (!config.SiteConfig.TMDBApiKey || config.SiteConfig.TMDBApiKey.trim() === '') { + return NextResponse.json( + { error: '请先在站点配置中配置 TMDB API Key' }, + { status: 400 } + ); + } + // 获取请求参数 const body = await request.json().catch(() => ({})); const clearMetaInfo = body.clearMetaInfo === true;