接入tunehub

This commit is contained in:
mtvpls
2026-02-01 15:36:33 +08:00
parent 74dc91d59e
commit 19be34c6fe
7 changed files with 1548 additions and 2 deletions

View File

@@ -69,6 +69,9 @@ export async function POST(request: NextRequest) {
OIDCClientSecret,
OIDCButtonText,
OIDCMinTrustLevel,
TuneHubEnabled,
TuneHubBaseUrl,
TuneHubApiKey,
} = body as {
SiteName: string;
Announcement: string;
@@ -110,6 +113,9 @@ export async function POST(request: NextRequest) {
OIDCClientSecret?: string;
OIDCButtonText?: string;
OIDCMinTrustLevel?: number;
TuneHubEnabled?: boolean;
TuneHubBaseUrl?: string;
TuneHubApiKey?: string;
};
// 参数校验
@@ -150,7 +156,10 @@ export async function POST(request: NextRequest) {
(OIDCClientId !== undefined && typeof OIDCClientId !== 'string') ||
(OIDCClientSecret !== undefined && typeof OIDCClientSecret !== 'string') ||
(OIDCButtonText !== undefined && typeof OIDCButtonText !== 'string') ||
(OIDCMinTrustLevel !== undefined && typeof OIDCMinTrustLevel !== 'number')
(OIDCMinTrustLevel !== undefined && typeof OIDCMinTrustLevel !== 'number') ||
(TuneHubEnabled !== undefined && typeof TuneHubEnabled !== 'boolean') ||
(TuneHubBaseUrl !== undefined && typeof TuneHubBaseUrl !== 'string') ||
(TuneHubApiKey !== undefined && typeof TuneHubApiKey !== 'string')
) {
return NextResponse.json({ error: '参数格式错误' }, { status: 400 });
}
@@ -207,6 +216,9 @@ export async function POST(request: NextRequest) {
OIDCClientSecret,
OIDCButtonText,
OIDCMinTrustLevel,
TuneHubEnabled,
TuneHubBaseUrl,
TuneHubApiKey,
};
// 写入数据库