mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Fix critical bug: searches now respect enabled indexers
**Problem:** Prowlarr searches were querying ALL indexers instead of only the ones enabled in user settings, causing torrents to be selected from disabled/untrusted indexers. **Root Cause:** The prowlarr.search() method didn't filter by indexer IDs, and callers weren't passing enabled indexer IDs to the search. **Changes:** 1. Added indexerIds parameter to SearchFilters interface 2. Updated prowlarr.service.ts search() to filter by indexerIds 3. Updated search-indexers.processor.ts to fetch and pass enabled indexer IDs 4. Updated interactive-search route to fetch and pass enabled indexer IDs 5. Added validation: search fails if no indexers are configured/enabled 6. Updated documentation to reflect indexer filtering behavior **Impact:** - Manual search: Only searches enabled indexers - Interactive search: Only searches enabled indexers - RSS monitoring: Already correctly filtered (no changes needed) **Testing:** TypeScript type checking passed with no errors
This commit is contained in:
@@ -50,13 +50,37 @@ export async function POST(
|
||||
);
|
||||
}
|
||||
|
||||
// Search Prowlarr for torrents
|
||||
// Get enabled indexers from configuration
|
||||
const { getConfigService } = await import('@/lib/services/config.service');
|
||||
const configService = getConfigService();
|
||||
const indexersConfigStr = await configService.get('prowlarr_indexers');
|
||||
|
||||
if (!indexersConfigStr) {
|
||||
return NextResponse.json(
|
||||
{ error: 'ConfigError', message: 'No indexers configured. Please configure indexers in settings.' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const indexersConfig = JSON.parse(indexersConfigStr);
|
||||
const enabledIndexerIds = indexersConfig.map((indexer: any) => indexer.id);
|
||||
|
||||
if (enabledIndexerIds.length === 0) {
|
||||
return NextResponse.json(
|
||||
{ error: 'ConfigError', message: 'No indexers enabled. Please enable at least one indexer in settings.' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// Search Prowlarr for torrents - ONLY enabled indexers
|
||||
const prowlarr = await getProwlarrService();
|
||||
const searchQuery = `${requestRecord.audiobook.title} ${requestRecord.audiobook.author}`;
|
||||
|
||||
console.log(`[InteractiveSearch] Searching for: ${searchQuery}`);
|
||||
console.log(`[InteractiveSearch] Searching ${enabledIndexerIds.length} enabled indexers for: ${searchQuery}`);
|
||||
|
||||
const results = await prowlarr.search(searchQuery);
|
||||
const results = await prowlarr.search(searchQuery, {
|
||||
indexerIds: enabledIndexerIds,
|
||||
});
|
||||
|
||||
if (results.length === 0) {
|
||||
return NextResponse.json({
|
||||
|
||||
Reference in New Issue
Block a user