mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user