openlist扫描前增加tmdbkey配置检测

This commit is contained in:
mtvpls
2026-01-15 15:11:36 +08:00
parent 2850b6bef8
commit 0655bbc875

View File

@@ -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;