From b0da4e90e7122f1846a90071de62ecd2c9a31a84 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Thu, 25 Dec 2025 01:02:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=A7=81=E4=BA=BA=E5=BD=B1?= =?UTF-8?q?=E5=BA=93=E5=85=B3=E9=97=AD=E5=90=8E=E8=BF=98=E8=83=BD=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=88=B0=E7=A7=81=E4=BA=BA=E5=BD=B1=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=92=8C=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/detail/route.ts | 10 ++++++++-- src/app/api/openlist/correct/route.ts | 10 ++++++++-- src/app/api/openlist/delete/route.ts | 8 ++++++-- src/app/api/openlist/detail/route.ts | 10 ++++++++-- src/app/api/openlist/list/route.ts | 10 ++++++++-- src/app/api/openlist/play/route.ts | 10 ++++++++-- src/app/api/openlist/refresh-video/route.ts | 10 ++++++++-- src/app/api/openlist/refresh/route.ts | 10 ++++++++-- src/app/api/search/route.ts | 7 ++++++- src/app/api/search/ws/route.ts | 7 ++++++- 10 files changed, 74 insertions(+), 18 deletions(-) diff --git a/src/app/api/detail/route.ts b/src/app/api/detail/route.ts index 8a03620..f5e993d 100644 --- a/src/app/api/detail/route.ts +++ b/src/app/api/detail/route.ts @@ -26,8 +26,14 @@ export async function GET(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { - throw new Error('OpenList 未配置'); + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { + throw new Error('OpenList 未配置或未启用'); } const rootPath = openListConfig.RootPath || '/'; diff --git a/src/app/api/openlist/correct/route.ts b/src/app/api/openlist/correct/route.ts index e956b2a..beb6e95 100644 --- a/src/app/api/openlist/correct/route.ts +++ b/src/app/api/openlist/correct/route.ts @@ -39,9 +39,15 @@ export async function POST(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { return NextResponse.json( - { error: 'OpenList 未配置' }, + { error: 'OpenList 未配置或未启用' }, { status: 400 } ); } diff --git a/src/app/api/openlist/delete/route.ts b/src/app/api/openlist/delete/route.ts index 7a04e04..e3fc1f7 100644 --- a/src/app/api/openlist/delete/route.ts +++ b/src/app/api/openlist/delete/route.ts @@ -38,9 +38,13 @@ export async function POST(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL) { + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL + ) { return NextResponse.json( - { error: 'OpenList 未配置' }, + { error: 'OpenList 未配置或未启用' }, { status: 400 } ); } diff --git a/src/app/api/openlist/detail/route.ts b/src/app/api/openlist/detail/route.ts index 300afea..68c91ee 100644 --- a/src/app/api/openlist/detail/route.ts +++ b/src/app/api/openlist/detail/route.ts @@ -35,8 +35,14 @@ export async function GET(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { - return NextResponse.json({ error: 'OpenList 未配置' }, { status: 400 }); + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { + return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } const rootPath = openListConfig.RootPath || '/'; diff --git a/src/app/api/openlist/list/route.ts b/src/app/api/openlist/list/route.ts index 8c67b18..ae32a3a 100644 --- a/src/app/api/openlist/list/route.ts +++ b/src/app/api/openlist/list/route.ts @@ -35,9 +35,15 @@ export async function GET(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { return NextResponse.json( - { error: 'OpenList 未配置', list: [], total: 0 }, + { error: 'OpenList 未配置或未启用', list: [], total: 0 }, { status: 200 } ); } diff --git a/src/app/api/openlist/play/route.ts b/src/app/api/openlist/play/route.ts index 731db4f..95955b5 100644 --- a/src/app/api/openlist/play/route.ts +++ b/src/app/api/openlist/play/route.ts @@ -31,8 +31,14 @@ export async function GET(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { - return NextResponse.json({ error: 'OpenList 未配置' }, { status: 400 }); + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { + return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } const rootPath = openListConfig.RootPath || '/'; diff --git a/src/app/api/openlist/refresh-video/route.ts b/src/app/api/openlist/refresh-video/route.ts index 50527e3..1c27877 100644 --- a/src/app/api/openlist/refresh-video/route.ts +++ b/src/app/api/openlist/refresh-video/route.ts @@ -30,8 +30,14 @@ export async function POST(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { - return NextResponse.json({ error: 'OpenList 未配置' }, { status: 400 }); + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { + return NextResponse.json({ error: 'OpenList 未配置或未启用' }, { status: 400 }); } const rootPath = openListConfig.RootPath || '/'; diff --git a/src/app/api/openlist/refresh/route.ts b/src/app/api/openlist/refresh/route.ts index 4fa3527..d815371 100644 --- a/src/app/api/openlist/refresh/route.ts +++ b/src/app/api/openlist/refresh/route.ts @@ -43,9 +43,15 @@ export async function POST(request: NextRequest) { const config = await getConfig(); const openListConfig = config.OpenListConfig; - if (!openListConfig || !openListConfig.URL || !openListConfig.Username || !openListConfig.Password) { + if ( + !openListConfig || + !openListConfig.Enabled || + !openListConfig.URL || + !openListConfig.Username || + !openListConfig.Password + ) { return NextResponse.json( - { error: 'OpenList 未配置' }, + { error: 'OpenList 未配置或未启用' }, { status: 400 } ); } diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 2b5a0ca..67c290b 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -37,7 +37,12 @@ export async function GET(request: NextRequest) { const apiSites = await getAvailableApiSites(authInfo.username); // 检查是否配置了 OpenList - const hasOpenList = !!(config.OpenListConfig?.URL && config.OpenListConfig?.Username && config.OpenListConfig?.Password); + const hasOpenList = !!( + config.OpenListConfig?.Enabled && + config.OpenListConfig?.URL && + config.OpenListConfig?.Username && + config.OpenListConfig?.Password + ); // 搜索 OpenList(如果配置了) let openlistResults: any[] = []; diff --git a/src/app/api/search/ws/route.ts b/src/app/api/search/ws/route.ts index c896d41..f404723 100644 --- a/src/app/api/search/ws/route.ts +++ b/src/app/api/search/ws/route.ts @@ -34,7 +34,12 @@ export async function GET(request: NextRequest) { const apiSites = await getAvailableApiSites(authInfo.username); // 检查是否配置了 OpenList - const hasOpenList = !!(config.OpenListConfig?.URL && config.OpenListConfig?.Username && config.OpenListConfig?.Password); + const hasOpenList = !!( + config.OpenListConfig?.Enabled && + config.OpenListConfig?.URL && + config.OpenListConfig?.Username && + config.OpenListConfig?.Password + ); // 共享状态 let streamClosed = false;