音乐增加代理开关

This commit is contained in:
mtvpls
2026-04-14 16:49:22 +08:00
parent 1dcf27d1f8
commit 0e41ba2661
6 changed files with 178 additions and 90 deletions
+5 -1
View File
@@ -32,17 +32,20 @@ export async function POST(request: NextRequest) {
Enabled,
BaseUrl,
Token,
ProxyEnabled,
} = body as {
Enabled?: boolean;
BaseUrl?: string;
Token?: string;
ProxyEnabled?: boolean;
};
// 参数校验
if (
(Enabled !== undefined && typeof Enabled !== 'boolean') ||
(BaseUrl !== undefined && typeof BaseUrl !== 'string') ||
(Token !== undefined && typeof Token !== 'string')
(Token !== undefined && typeof Token !== 'string') ||
(ProxyEnabled !== undefined && typeof ProxyEnabled !== 'boolean')
) {
return NextResponse.json({ error: '参数格式错误' }, { status: 400 });
}
@@ -62,6 +65,7 @@ export async function POST(request: NextRequest) {
Enabled,
BaseUrl,
Token,
ProxyEnabled: ProxyEnabled ?? true,
};
// 写入数据库