Add qBittorrent and SABnzbd: a Download clients page with stuck, disconnected, paused and full-disk alerts

Each client is read every five minutes (read-only; qBittorrent's sign-in is the only POST): speed, queue and item states, network connection or paused queue, free space, SABnzbd's failures and warnings. Shared adapter, sync service, download_state table, /api/downloads, metrics and docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-04 23:13:03 +01:00
1 parent c7775e5dd9
commit 7618bf0f0a
32 files changed
+10715 -12

No files matched your search

+27
View File
@@ -578,6 +578,8 @@ export const integrationTypes = [
"grafana",
"lidarr",
"readarr",
"qbittorrent",
"sabnzbd",
] as const;
export type IntegrationType = (typeof integrationTypes)[number];
@@ -1365,6 +1367,31 @@ export const arrState = sqliteTable("arr_state", {
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── qBittorrent, SABnzbd ───────────────────────────────────────────────────
// How a download client (an integration of type "qbittorrent" or "sabnzbd") is right now, one row each, replaced at every read: how fast it is going, whether it can reach the network (qBittorrent) or
// is paused (SABnzbd), how many items are in each state, the items that are not just sitting finished, what failed lately (SABnzbd), the room its download folders have and its own warnings
// (SABnzbd) — plus since when it has been paused, disconnected or idle with work waiting, which only this app can know. A column that is null could not be read, which is not the same as none.
// Read by services/downloadsSync.ts.
export const downloadState = sqliteTable("download_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
version: text("version"),
speedDown: integer("speed_down"), // bytes per second; null: not said
speedUp: integer("speed_up"),
paused: integer("paused", { mode: "boolean" }).notNull().default(false),
connection: text("connection"), // connected | firewalled | disconnected; null: not said (always null for SABnzbd)
counts: text("counts").notNull(), // JSON: items in each state
total: integer("total").notNull().default(0),
items: text("items").notNull().default("[]"), // JSON: the items that are not finished and idle, at most 100
failed: text("failed"), // JSON: failed downloads (SABnzbd's history); null: not said
disks: text("disks"), // JSON; null: could not be read
warnings: text("warnings"), // JSON { count, recent }; null: not read
since: text("since").notNull().default("{}"), // JSON { pausedSince, disconnectedSince, idleSince }
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── AdGuard Home ───────────────────────────────────────────────────────────
// How an AdGuard Home (an integration of type "adguard") is right now, one row each, replaced at every read: whether its DNS server runs and protects, the statistics, its filter lists and the result