Improve user auth handling and download monitoring

Adds detection of local users for authentication validation and login, prevents role changes for OIDC users, and clarifies user management UI. Enhances active downloads API to include speed and ETA from qBittorrent, and improves file path handling in download monitoring. Also updates torrent tagging and user info returned by APIs.
This commit is contained in:
kikootwo
2025-12-23 13:38:13 -05:00
parent 174e9f05b6
commit bb42281dac
11 changed files with 169 additions and 40 deletions
+18 -2
View File
@@ -5,6 +5,7 @@
import { NextResponse } from 'next/server';
import { ConfigurationService } from '@/lib/services/config.service';
import { prisma } from '@/lib/db';
export async function GET() {
try {
@@ -17,22 +18,36 @@ export async function GET() {
const registrationEnabled = (await configService.get('auth.registration_enabled')) === 'true';
const oidcProviderName = await configService.get('oidc.provider_name') || 'SSO';
// Check if any local users exist in database (for login form visibility)
const hasLocalUsers = (await prisma.user.count({
where: { authProvider: 'local' }
})) > 0;
const providers: string[] = [];
if (oidcEnabled) providers.push('oidc');
if (registrationEnabled) providers.push('local');
if (hasLocalUsers) providers.push('local');
return NextResponse.json({
backendMode: 'audiobookshelf',
providers,
registrationEnabled,
hasLocalUsers,
oidcProviderName: oidcEnabled ? oidcProviderName : null,
});
} else {
// Plex mode
// Plex mode - check if local admin exists (setup admin)
const hasLocalUsers = (await prisma.user.count({
where: {
plexId: { startsWith: 'local-' },
isSetupAdmin: true
}
})) > 0;
return NextResponse.json({
backendMode: 'plex',
providers: ['plex'],
registrationEnabled: false,
hasLocalUsers,
oidcProviderName: null,
});
}
@@ -43,6 +58,7 @@ export async function GET() {
backendMode: 'plex',
providers: ['plex'],
registrationEnabled: false,
hasLocalUsers: false,
oidcProviderName: null,
});
}