feat: add per-library download detection auto-schedule

Adds a configurable schedule (manual/hourly/daily/weekly) for the
download detection job in the library settings modal. The indexer
scheduler triggers the job automatically, and the API job poller
processes it — consistent with the reading_status_push pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 13:57:59 +01:00
parent 19de3ceebb
commit e0d94758af
12 changed files with 212 additions and 35 deletions

View File

@@ -17,6 +17,8 @@ export type LibraryDto = {
reading_status_provider: string | null;
reading_status_push_mode: string;
next_reading_status_push_at: string | null;
download_detection_mode: string;
next_download_detection_at: string | null;
};
export type IndexJobDto = {
@@ -301,12 +303,14 @@ export async function updateLibraryMonitoring(
scanMode: string,
watcherEnabled?: boolean,
metadataRefreshMode?: string,
downloadDetectionMode?: string,
) {
const body: {
monitor_enabled: boolean;
scan_mode: string;
watcher_enabled?: boolean;
metadata_refresh_mode?: string;
download_detection_mode?: string;
} = {
monitor_enabled: monitorEnabled,
scan_mode: scanMode,
@@ -317,6 +321,9 @@ export async function updateLibraryMonitoring(
if (metadataRefreshMode !== undefined) {
body.metadata_refresh_mode = metadataRefreshMode;
}
if (downloadDetectionMode !== undefined) {
body.download_detection_mode = downloadDetectionMode;
}
return apiFetch<LibraryDto>(`/libraries/${libraryId}/monitoring`, {
method: "PATCH",
body: JSON.stringify(body),