/** * Component: Setup Wizard Download Client Step * Documentation: documentation/setup-wizard.md */ 'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; interface DownloadClientStepProps { downloadClient: 'qbittorrent' | 'transmission'; downloadClientUrl: string; downloadClientUsername: string; downloadClientPassword: string; remotePathMappingEnabled: boolean; remotePath: string; localPath: string; onUpdate: (field: string, value: any) => void; onNext: () => void; onBack: () => void; } export function DownloadClientStep({ downloadClient, downloadClientUrl, downloadClientUsername, downloadClientPassword, remotePathMappingEnabled, remotePath, localPath, onUpdate, onNext, onBack, }: DownloadClientStepProps) { const [testing, setTesting] = useState(false); const [testResult, setTestResult] = useState<{ success: boolean; message: string; version?: string; } | null>(null); const testConnection = async () => { setTesting(true); setTestResult(null); try { const response = await fetch('/api/setup/test-download-client', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ type: downloadClient, url: downloadClientUrl, username: downloadClientUsername, password: downloadClientPassword, remotePathMappingEnabled, remotePath, localPath, }), }); const data = await response.json(); if (response.ok && data.success) { setTestResult({ success: true, message: `Connected successfully! ${data.version ? `Version: ${data.version}` : ''}`, version: data.version, }); } else { setTestResult({ success: false, message: data.error || 'Connection failed', }); } } catch (error) { setTestResult({ success: false, message: error instanceof Error ? error.message : 'Connection test failed', }); } finally { setTesting(false); } }; const handleNext = () => { if (!testResult?.success) { setTestResult({ success: false, message: 'Please test the connection before proceeding', }); return; } onNext(); }; return (
Choose and configure your torrent download client.
The URL where your download client is running (include port)
Use this when qBittorrent runs on a different machine or uses different mount points (e.g., remote seedbox, Docker containers)
Example: Remote /remote/mnt/d/done → Local /downloads
{/* Conditional Fields */} {remotePathMappingEnabled && (The path prefix as reported by qBittorrent
The actual path where files are accessible
{testResult.message}
{downloadClient === 'qbittorrent' ? 'qBittorrent Setup' : 'Transmission Setup'}
{downloadClient === 'qbittorrent' ? 'Make sure Web UI is enabled in qBittorrent settings (Tools → Options → Web UI)' : 'Transmission support is coming soon. Please use qBittorrent for now.'}