feat: add local settings

This commit is contained in:
shinya
2025-07-15 00:35:28 +08:00
parent 76eacd97f9
commit 61cd291574
21 changed files with 741 additions and 126 deletions

View File

@@ -33,13 +33,11 @@ export async function POST(request: NextRequest) {
Announcement,
SearchDownstreamMaxPage,
SiteInterfaceCacheTime,
SearchResultDefaultAggregate,
} = body as {
SiteName: string;
Announcement: string;
SearchDownstreamMaxPage: number;
SiteInterfaceCacheTime: number;
SearchResultDefaultAggregate: boolean;
};
// 参数校验
@@ -47,8 +45,7 @@ export async function POST(request: NextRequest) {
typeof SiteName !== 'string' ||
typeof Announcement !== 'string' ||
typeof SearchDownstreamMaxPage !== 'number' ||
typeof SiteInterfaceCacheTime !== 'number' ||
typeof SearchResultDefaultAggregate !== 'boolean'
typeof SiteInterfaceCacheTime !== 'number'
) {
return NextResponse.json({ error: '参数格式错误' }, { status: 400 });
}
@@ -73,7 +70,6 @@ export async function POST(request: NextRequest) {
Announcement,
SearchDownstreamMaxPage,
SiteInterfaceCacheTime,
SearchResultDefaultAggregate,
};
// 写入数据库

View File

@@ -43,7 +43,7 @@ export async function GET(request: Request) {
}
// 设置缓存头(可选)
headers.set('Cache-Control', 'public, max-age=86400'); // 缓存24小时
headers.set('Cache-Control', 'public, max-age=15720000'); // 缓存半年
// 直接返回图片流
return new Response(imageResponse.body, {