AdGuard Home, Grafana, Docker image age, foldable server page cards

New integration kinds adguard (status, statistics, filter lists and a real DNS question
over UDP; alerts for DNS down/not running, protection left off, stale lists) and grafana
(alert rules firing or failing, data-source health). Optional warning for running Docker
images built more than N days ago (off by default). A server's overview cards can be
folded and arranged, kept per user. Migrations 0075-0077; docs, metrics and tests included.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-27 22:13:03 +01:00
1 parent 3d9a2310bb
commit 551eb1597a
53 files changed
+27700 -33

No files matched your search

+42
View File
@@ -26,6 +26,9 @@ export const users = sqliteTable("users", {
// How this person arranged the dashboard: a JSON object with the cards they hid ("hidden": ["Gitea"]) and the order of the others
// ("order": {"DNS": 0, "Secrets": 1}). Follows them to any browser; null is the default layout.
dashboardLayout: text("dashboard_layout"),
// How this person arranged a server's overview page: the cards they folded ("folded": ["admin-links"]) and the order of the blocks ("order": {"notes": 10}). The same for every server;
// follows them to any browser; null is the page as drawn.
serverPageLayout: text("server_page_layout"),
// The address of the picture the identity provider gave for this person (the OIDC "picture" claim), as of their last sign-in. Only an address:
// nothing is fetched from it unless Settings → Sign-in → Profile pictures allows it, and then only by this server, never by the browser.
pictureUrl: text("picture_url"),
@@ -567,6 +570,8 @@ export const integrationTypes = [
"sonarr",
"radarr",
"prowlarr",
"adguard",
"grafana",
] as const;
export type IntegrationType = (typeof integrationTypes)[number];
@@ -1206,6 +1211,8 @@ export const dockhandVulnerabilities = sqliteTable(
imagesScanned: integer("images_scanned"),
totalImages: integer("total_images"),
findings: text("findings").notNull().default("[]"), // JSON: the critical findings (cve, package, installedVersion, fixedVersion, imageName, containers), at most 100
images: text("images"), // JSON: the images the running containers of this host use, each with when it was built (image, created, containers); null: never read, or could not be
imagesAt: text("images_at"), // ISO: when `images` was last read
updatedAt: text("updated_at").notNull(), // ISO
},
(t) => [primaryKey({ columns: [t.integrationId, t.environmentId] })],
@@ -1322,6 +1329,41 @@ export const arrState = sqliteTable("arr_state", {
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
// of a real DNS question put to it — plus since when protection has been off and the question unanswered, which only this app can know. A column that is null could not be read. Read by
// services/adguardSync.ts.
export const adguardState = sqliteTable("adguard_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
version: text("version"),
running: integer("running", { mode: "boolean" }).notNull().default(true),
protectionEnabled: integer("protection_enabled", { mode: "boolean" }).notNull().default(true),
protectionOffSince: text("protection_off_since"), // ISO: the first read that showed protection off; null while it is on
dnsPort: integer("dns_port").notNull().default(53),
stats: text("stats"), // JSON: queries, blocked, average time, top names and clients; null: could not be read
filters: text("filters"), // JSON: { enabled, lists: [{ name, enabled, rules, updated }] }; null: could not be read
probe: text("probe"), // JSON: the DNS question — { ok, ms, error, name, host }
probeFailSince: text("probe_fail_since"), // ISO: the first read in which the question went unanswered; null while it is answered
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── Grafana ────────────────────────────────────────────────────────────────
// How a Grafana (an integration of type "grafana") is right now, one row each, replaced at every read: the alert rules that are firing, pending or cannot be evaluated (and how many there are), and
// its data sources with the result of Grafana's own health check of each. A column that is null could not be read. Read by services/grafanaSync.ts.
export const grafanaState = sqliteTable("grafana_state", {
integrationId: integer("integration_id")
.primaryKey()
.references(() => integrations.id, { onDelete: "cascade" }),
version: text("version"),
rules: text("rules"), // JSON { total, items }; null: could not be read
datasources: text("datasources"), // JSON; null: could not be listed
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── NetBox ─────────────────────────────────────────────────────────────────
// How a NetBox (an integration of type "netbox") is right now, one row each, replaced at every read: its version, how many background workers are running, the counts and the IP