mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
Add extensible notification providers + UI/API
Introduce a provider-based notification system and wire it through the API and admin UI. Added INotificationProvider + notification service implementation and providers (apprise, discord, ntfy, pushover), plus a GET /api/admin/notifications/providers endpoint to expose provider metadata. Refactored code to use provider type strings (removed enum coupling), updated masking/encryption calls, and simplified the test notification endpoint to accept backendId or type+config and call sendToBackend directly. UI: NotificationsTab now fetches provider metadata and renders provider cards and dynamic config forms (fields driven by provider metadata). Added config field rendering, improved backend cards, and edit/delete actions. APIs: New providers route, updated admin notification CRUD routes to validate provider types dynamically, updated test route schema. Added download-client categories POST API to fetch categories from clients and wired postImportCategory handling in download-client routes. Other notable changes: BookDate now fetches Claude models dynamically from Anthropic's Models API; added paginated model fetch helper. Added ALLOW_WEAK_PASSWORD flag exposure to auth providers and password change logic. Doc updates and various tests added/updated. File-organization doc clarifies EPERM fix using stream-based copy.
This commit is contained in:
@@ -208,6 +208,55 @@ export class ProwlarrService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search with multiple query variations to increase coverage
|
||||
* Fires 2 queries per call: "title author" and "title", then deduplicates by guid
|
||||
*/
|
||||
async searchWithVariations(
|
||||
title: string,
|
||||
author: string,
|
||||
filters?: SearchFilters
|
||||
): Promise<TorrentResult[]> {
|
||||
const queries = [
|
||||
`${title} ${author}`,
|
||||
title,
|
||||
];
|
||||
|
||||
logger.info(`Searching with ${queries.length} query variations`, { queries });
|
||||
|
||||
const allResults: TorrentResult[] = [];
|
||||
|
||||
for (const query of queries) {
|
||||
try {
|
||||
const results = await this.search(query, filters);
|
||||
logger.info(`Query "${query}" returned ${results.length} results`);
|
||||
allResults.push(...results);
|
||||
} catch (error) {
|
||||
logger.error(`Query "${query}" failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
// Continue with other queries even if one fails
|
||||
}
|
||||
}
|
||||
|
||||
const deduplicated = this.deduplicateResults(allResults);
|
||||
logger.info(`Multi-query search: ${allResults.length} total → ${deduplicated.length} after dedup (${allResults.length - deduplicated.length} duplicates removed)`);
|
||||
|
||||
return deduplicated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deduplicate results by guid, preserving order (first occurrence wins)
|
||||
*/
|
||||
private deduplicateResults(results: TorrentResult[]): TorrentResult[] {
|
||||
const seen = new Set<string>();
|
||||
return results.filter(result => {
|
||||
if (seen.has(result.guid)) {
|
||||
return false;
|
||||
}
|
||||
seen.add(result.guid);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of configured indexers
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user