mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-03-02 17:27:31 +08:00
feat: add local settings
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
// 写入数据库
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user