Optional qBittorrent creds; require SABnzbd key

Allow qBittorrent to be configured without credentials (supports IP whitelist) and require an API key for SABnzbd. Skip connection testing when disabling a client. Updates include: validation changes in admin and setup API routes, test-download-client flows, DownloadClientModal UI validation and save/test logic, and DownloadClientManager to pass empty strings for optional credentials. Tests updated to reflect SABnzbd API key requirement.
This commit is contained in:
kikootwo
2026-02-03 13:30:51 -05:00
parent c559f8ebe9
commit 863f8466ea
8 changed files with 47 additions and 44 deletions
@@ -66,29 +66,32 @@ export async function POST(request: NextRequest) {
}
// Validate required fields
if (!url || !effectivePassword) {
// URL is always required; password/API key only required for SABnzbd
// qBittorrent supports IP whitelist auth (no credentials needed)
if (!url) {
return NextResponse.json(
{ error: 'URL and password/API key are required' },
{ error: 'URL is required' },
{ status: 400 }
);
}
if (type === 'qbittorrent' && !effectiveUsername) {
if (type === 'sabnzbd' && !effectivePassword) {
return NextResponse.json(
{ error: 'Username is required for qBittorrent' },
{ error: 'API key is required for SABnzbd' },
{ status: 400 }
);
}
// Create temporary client config for testing
// qBittorrent credentials are optional (supports IP whitelist auth)
const testConfig: DownloadClientConfig = {
id: 'test',
type,
name: 'Test Client',
enabled: true,
url,
username: effectiveUsername || undefined,
password: effectivePassword,
username: effectiveUsername || '',
password: effectivePassword || '',
disableSSLVerify: disableSSLVerify || false,
remotePathMappingEnabled: remotePathMappingEnabled || false,
remotePath: remotePath || undefined,