Add a weekly digest and report which version of the agent each server runs

- Weekly digest through the notification channels: alerts now, a week of uptime, what happened, disks
  heading for full, expiring secrets and domains, updates waiting, planned maintenance. Off until switched
  on in Settings -> Notifications; Preview and Send it now there. Setting key 'digest'.
- Agents say their version in every report (Linux and Windows scripts are version 2); the server compares
  it with the scripts it serves and marks agents that are behind on the Servers, server and Updates pages.
  servers.agent_version, migration 0026.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-17 19:49:36 +02:00
1 parent 3da5c639b1
commit aa94d84f6c
28 files changed
+3179 -19

No files matched your search

+24 -2
View File
@@ -401,6 +401,15 @@ export interface QuietHoursSettings {
end: string;
}
/** The weekly digest: one message a week through the notification channels. */
export interface DigestSettings {
enabled: boolean;
/** 0 = Sunday … 6 = Saturday, in the notification time zone. */
day: number;
/** "HH:MM", in the notification time zone. */
time: string;
}
export interface AppSettings {
gotify: GotifySettings;
ntfy: NtfySettings;
@@ -413,6 +422,7 @@ export interface AppSettings {
logRetention: LogRetentionSettings;
quietHours: QuietHoursSettings;
healthChecks: HealthCheckSettings;
digest: DigestSettings;
}
export type AppSettingsPatch = { [K in keyof AppSettings]?: Partial<AppSettings[K]> };
@@ -496,6 +506,14 @@ export interface ServerRecord {
pendingUpdates: PendingUpdates | null;
/** When updates were first seen waiting (and none were before); null when none are. */
updatesPendingSince: string | null;
/** Which version of the agent script it runs, as the agent says; null from one that predates the number (version 1). */
agentVersion: number | null;
}
/** The agent version a new install would be, per system; null when this app can't tell. */
export interface AgentLatest {
linux: number | null;
windows: number | null;
}
export interface PendingUpdates {
@@ -515,6 +533,7 @@ export interface UpdatesServer {
lastSeenAt: string | null;
updates: PendingUpdates | null;
pendingSince: string | null;
agentVersion: number | null;
}
/** What a server runs on, and what runs on it. `auto`: worked out from the Proxmox node rather than set by hand. */
@@ -564,6 +583,7 @@ export interface ServerDetail {
dnsMatches: DnsMatch[];
links: ServerLink[];
relations: { parent: ServerRelation | null; children: ServerRelation[] };
agentLatest: AgentLatest;
}
export type AlertSeverity = "critical" | "warning" | "info";
@@ -1445,7 +1465,7 @@ export const api = {
clearCache: () => request<{ ok: true }>("/api/dns/cache/clear", { method: "POST" }),
},
servers: {
list: () => request<{ servers: ServerRecord[] }>("/api/servers"),
list: () => request<{ servers: ServerRecord[]; agentLatest: AgentLatest }>("/api/servers"),
create: (data: { name: string; hostname?: string; description?: string; osType?: "linux" | "windows" }) =>
request<{ server: ServerRecord; token: string }>("/api/servers", {
method: "POST",
@@ -1458,7 +1478,7 @@ export const api = {
update: (id: number, data: ServerUpdateInput) =>
request<{ server: ServerRecord }>(`/api/servers/${id}`, { method: "PATCH", body: JSON.stringify(data) }),
summary: () => request<ServerSummary>("/api/servers/summary"),
updates: () => request<{ servers: UpdatesServer[] }>("/api/servers/updates"),
updates: () => request<{ servers: UpdatesServer[]; agentLatest: AgentLatest }>("/api/servers/updates"),
detail: (id: number) => request<ServerDetail>(`/api/servers/${id}/detail`),
activity: (id: number) => request<{ events: ServerActivityEvent[] }>(`/api/servers/${id}/activity`),
metrics: (id: number, days: number) => request<{ days: number; series: ServerMetricSeries[] }>(`/api/servers/${id}/metrics?days=${days}`),
@@ -1677,5 +1697,7 @@ export const api = {
"/api/settings/quiet-hours-queue",
),
flushQuietHours: () => request<{ flushed: number }>("/api/settings/flush-quiet-hours", { method: "POST" }),
digestPreview: () => request<{ title: string; message: string; quiet: boolean; channels: number }>("/api/settings/digest/preview"),
digestSend: () => request<{ sent: boolean; channels: number }>("/api/settings/digest/send", { method: "POST" }),
},
};