/** * Component: Indexers Settings Tab * Documentation: documentation/settings-pages.md */ 'use client'; import React, { useEffect } from 'react'; import { Button } from '@/components/ui/Button'; import { ConfirmModal } from '@/components/ui/ConfirmModal'; import { Input } from '@/components/ui/Input'; import { IndexerManagement } from '@/components/admin/indexers/IndexerManagement'; import { FlagConfigRow } from '@/components/admin/FlagConfigRow'; import { IndexerFlagConfig } from '@/lib/utils/ranking-algorithm'; import { useIndexersSettings } from './useIndexersSettings'; import type { Settings, SavedIndexerConfig } from '../../lib/types'; interface IndexersTabProps { settings: Settings; originalSettings: Settings | null; indexers: SavedIndexerConfig[]; flagConfigs: IndexerFlagConfig[]; onChange: (settings: Settings) => void; onIndexersChange: (indexers: SavedIndexerConfig[]) => void; onFlagConfigsChange: (configs: IndexerFlagConfig[]) => void; onValidationChange: (isValid: boolean) => void; onRefreshIndexers?: () => Promise; } export function IndexersTab({ settings, originalSettings, indexers, flagConfigs, onChange, onIndexersChange, onFlagConfigsChange, onValidationChange, onRefreshIndexers, }: IndexersTabProps) { const { testing, testResult, testConnection, showConnectionChangeConfirm, confirmConnectionChange, cancelConnectionChange, configuredIndexersCount, } = useIndexersSettings({ prowlarrUrl: settings.prowlarr.url, prowlarrApiKey: settings.prowlarr.apiKey, originalProwlarrUrl: originalSettings?.prowlarr.url ?? '', originalProwlarrApiKey: originalSettings?.prowlarr.apiKey ?? '', configuredIndexersCount: indexers.length, onValidationChange, onRefreshIndexers, onClearIndexers: () => onIndexersChange([]), }); // Auto-load indexers when component mounts if prowlarr is configured useEffect(() => { if (settings.prowlarr.url && settings.prowlarr.apiKey && onRefreshIndexers) { onRefreshIndexers(); } // Only run on mount, not when settings change // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return (

Indexer Configuration

Configure your Prowlarr connection and manage which indexers to use with priority and seeding time.

{ onChange({ ...settings, prowlarr: { ...settings.prowlarr, url: e.target.value }, }); onValidationChange(false); }} placeholder="http://localhost:9696" />
{ onChange({ ...settings, prowlarr: { ...settings.prowlarr, apiKey: e.target.value }, }); onValidationChange(false); }} placeholder="Enter API key" />

Found in Prowlarr Settings → General → Security → API Key

{testResult && (
{testResult.message}
)}
{/* Flag Configuration Section */}

Indexer Flag Configuration (Optional)

Configure score bonuses or penalties for indexer flags like "Freeleech". These modifiers apply universally across all indexers and affect final torrent ranking.

{flagConfigs.length > 0 && (
{flagConfigs.map((config, index) => ( { const newConfigs = [...flagConfigs]; newConfigs[index] = updated; onFlagConfigsChange(newConfigs); }} onRemove={() => { onFlagConfigsChange(flagConfigs.filter((_, i) => i !== index)); }} /> ))}
)} {flagConfigs.length === 0 && (

No flag rules configured. Flag bonuses/penalties are optional.

)}
{/* Confirmation modal for Prowlarr connection change */}
); }