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

+39 -2
View File
@@ -40,9 +40,9 @@ export function parseDashboardLayout(stored: string | null): DashboardLayout {
meRouter.get("/", requireAuth, asyncHandler(async (req, res) => {
const me = req.currentUser!;
const { id, email, name, role, oidcSub, favorites, dashboardLayout } = me;
const { id, email, name, role, oidcSub, favorites, dashboardLayout, serverPageLayout } = me;
const avatarUrl = avatarUrlFor(me, (await getSettings()).profilePictures);
res.json({ user: { id, sub: oidcSub, email, name, role, avatarUrl, favorites: parseFavorites(favorites), dashboard: parseDashboardLayout(dashboardLayout) } });
res.json({ user: { id, sub: oidcSub, email, name, role, avatarUrl, favorites: parseFavorites(favorites), dashboard: parseDashboardLayout(dashboardLayout), serverPage: parsePageLayout(serverPageLayout) } });
}));
// Paths inside the app only: a slash, then letters, digits, dashes, underscores and further slashes — and, for a saved view of a page,
@@ -68,6 +68,31 @@ const dashboardSchema = z.object({
order: z.record(cardName, z.number().int().min(0).max(1000)).refine((o) => Object.keys(o).length <= MAX_LAYOUT_CARDS, "Too many cards"),
});
export interface PageLayout {
/** Blocks (cards) the person folded: only their header shows. */
folded: string[];
/** Position of a block among the others on the page; lower comes first. */
order: Record<string, number>;
}
const blockName = z.string().regex(/^[a-z0-9-]{1,40}$/);
const pageLayoutSchema = z.object({
folded: z.array(blockName).max(MAX_LAYOUT_CARDS),
order: z.record(blockName, z.number().int().min(0).max(1000)).refine((o) => Object.keys(o).length <= MAX_LAYOUT_CARDS, "Too many blocks"),
});
/** What is stored for a page, read back as a layout. Anything that isn't one is the page as drawn rather than an error. */
export function parsePageLayout(stored: string | null): PageLayout {
const empty: PageLayout = { folded: [], order: {} };
if (!stored) return empty;
try {
const parsed = pageLayoutSchema.safeParse(JSON.parse(stored));
return parsed.success ? parsed.data : empty;
} catch {
return empty;
}
}
// Replaces the signed-in person's pinned pages. Only ever their own.
meRouter.put("/favorites", requireAuth, asyncHandler(async (req, res) => {
const parsed = favoritesSchema.safeParse(req.body);
@@ -104,6 +129,18 @@ meRouter.post("/changes/seen", requireAuth, asyncHandler(async (req, res) => {
res.json({ lastLookedAt: at });
}));
// Replaces how the signed-in person arranged a server's overview page. Only ever their own.
meRouter.put("/server-page", requireAuth, asyncHandler(async (req, res) => {
const parsed = pageLayoutSchema.safeParse(req.body);
if (!parsed.success) {
return res.status(400).json({ error: "invalid_body", message: "Name the blocks to fold and the order of the rest.", details: parsed.error.flatten() });
}
const layout: PageLayout = { folded: [...new Set(parsed.data.folded)], order: parsed.data.order };
const empty = layout.folded.length === 0 && Object.keys(layout.order).length === 0;
await db.update(users).set({ serverPageLayout: empty ? null : JSON.stringify(layout) }).where(eq(users.id, req.currentUser!.id));
res.json({ serverPage: layout });
}));
// Replaces how the signed-in person arranged the dashboard. Only ever their own.
meRouter.put("/dashboard", requireAuth, asyncHandler(async (req, res) => {
const parsed = dashboardSchema.safeParse(req.body);