emby支持无密码登录

This commit is contained in:
mtvpls
2026-03-07 10:19:38 +08:00
parent 82e6a33b00
commit 047691d1a5
3 changed files with 136 additions and 61 deletions
+4 -4
View File
@@ -52,9 +52,9 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ error: '请填写 Emby 服务器地址' }, { status: 400 });
}
if (!ApiKey && (!Username || !Password)) {
if (!ApiKey && !Username) {
return NextResponse.json(
{ error: '请填写 API Key 或用户名密码' },
{ error: '请填写 API Key 或用户名' },
{ status: 400 }
);
}
@@ -69,9 +69,9 @@ export async function POST(request: NextRequest) {
const client = new EmbyClient(testConfig);
// 如果使用用户名密码,先认证
if (!ApiKey && Username && Password) {
if (!ApiKey && Username) {
try {
await client.authenticate(Username, Password);
await client.authenticate(Username, Password || '');
} catch (error) {
return NextResponse.json(
{ success: false, message: 'Emby 认证失败: ' + (error as Error).message },