From c65ce8c55d61696b56bdd906ddb290440244e3c1 Mon Sep 17 00:00:00 2001 From: shinya Date: Thu, 25 Sep 2025 00:54:27 +0800 Subject: [PATCH] fix bangumi --- CHANGELOG | 7 +++++++ VERSION.txt | 2 +- src/app/api/favorites/route.ts | 6 +++--- src/app/api/playrecords/route.ts | 6 +++--- src/app/api/searchhistory/route.ts | 6 +++--- src/app/api/skipconfigs/route.ts | 6 +++--- src/lib/bangumi.client.ts | 7 ++++++- src/lib/changelog.ts | 14 ++++++++++++++ src/lib/version.ts | 2 +- 9 files changed, 41 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2527cad..ad5dd31 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +## [100.0.1] - 2025-09-25 + +### Fixed + +- 修复错误的环境变量 ADMIN_USERNAME +- 修复 bangumi 数据中没有图片导致首页崩溃问题 + ## [100.0.0] - 2025-08-26 ### Added diff --git a/VERSION.txt b/VERSION.txt index e865b95..86e3642 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -100.0.0 \ No newline at end of file +100.0.1 \ No newline at end of file diff --git a/src/app/api/favorites/route.ts b/src/app/api/favorites/route.ts index 4bd7724..4e64310 100644 --- a/src/app/api/favorites/route.ts +++ b/src/app/api/favorites/route.ts @@ -25,7 +25,7 @@ export async function GET(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -79,7 +79,7 @@ export async function POST(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -150,7 +150,7 @@ export async function DELETE(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username diff --git a/src/app/api/playrecords/route.ts b/src/app/api/playrecords/route.ts index 181ad0a..95cd8b6 100644 --- a/src/app/api/playrecords/route.ts +++ b/src/app/api/playrecords/route.ts @@ -18,7 +18,7 @@ export async function GET(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -51,7 +51,7 @@ export async function POST(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -117,7 +117,7 @@ export async function DELETE(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username diff --git a/src/app/api/searchhistory/route.ts b/src/app/api/searchhistory/route.ts index 9a9e717..9304b99 100644 --- a/src/app/api/searchhistory/route.ts +++ b/src/app/api/searchhistory/route.ts @@ -24,7 +24,7 @@ export async function GET(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -61,7 +61,7 @@ export async function POST(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -113,7 +113,7 @@ export async function DELETE(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username diff --git a/src/app/api/skipconfigs/route.ts b/src/app/api/skipconfigs/route.ts index 3762c4a..9d57a8a 100644 --- a/src/app/api/skipconfigs/route.ts +++ b/src/app/api/skipconfigs/route.ts @@ -17,7 +17,7 @@ export async function GET(request: NextRequest) { } const config = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = config.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -60,7 +60,7 @@ export async function POST(request: NextRequest) { } const adminConfig = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = adminConfig.UserConfig.Users.find( (u) => u.username === authInfo.username @@ -113,7 +113,7 @@ export async function DELETE(request: NextRequest) { } const adminConfig = await getConfig(); - if (authInfo.username !== process.env.ADMIN_USERNAME) { + if (authInfo.username !== process.env.USERNAME) { // 非站长,检查用户存在或被封禁 const user = adminConfig.UserConfig.Users.find( (u) => u.username === authInfo.username diff --git a/src/lib/bangumi.client.ts b/src/lib/bangumi.client.ts index 678ebae..8f56953 100644 --- a/src/lib/bangumi.client.ts +++ b/src/lib/bangumi.client.ts @@ -25,5 +25,10 @@ export interface BangumiCalendarData { export async function GetBangumiCalendarData(): Promise { const response = await fetch('https://api.bgm.tv/calendar'); const data = await response.json(); - return data; + const filteredData = data.map((item: BangumiCalendarData) => ({ + ...item, + items: item.items.filter(bangumiItem => bangumiItem.images) + })); + + return filteredData; } diff --git a/src/lib/changelog.ts b/src/lib/changelog.ts index 44b8af2..48d1eca 100644 --- a/src/lib/changelog.ts +++ b/src/lib/changelog.ts @@ -10,6 +10,20 @@ export interface ChangelogEntry { } export const changelog: ChangelogEntry[] = [ + { + version: "100.0.1", + date: "2025-09-25", + added: [ + // 无新增内容 + ], + changed: [ + // 无变更内容 + ], + fixed: [ + "修复错误的环境变量 ADMIN_USERNAME", + "修复 bangumi 数据中没有图片导致首页崩溃问题" + ] + }, { version: "100.0.0", date: "2025-08-26", diff --git a/src/lib/version.ts b/src/lib/version.ts index ff70a3b..a30874b 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -const CURRENT_VERSION = '100.0.0'; +const CURRENT_VERSION = '100.0.1'; // 导出当前版本号供其他地方使用 export { CURRENT_VERSION };