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:
1 parent
3da5c639b1
commit
aa94d84f6c
28 files changed
+3179
-19
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import type { AgentLatest } from "../api/client";
|
||||
|
||||
/** What an agent's version means for a server, for the badges: not on an agent at all, current, or behind. */
|
||||
export type AgentState = "none" | "current" | "behind";
|
||||
|
||||
/**
|
||||
* Whether a server's agent is behind what this Homelab Manager would install today. The same rule the server uses: only a server that
|
||||
* reports through an agent has one, and an agent that says no version is version 1.
|
||||
*/
|
||||
export function agentState(server: { osType: string; lastSeenAt: string | null; agentVersion: number | null }, latest: AgentLatest | null): AgentState {
|
||||
if (!server.lastSeenAt) return "none";
|
||||
const newest = latest ? (server.osType === "windows" ? latest.windows : server.osType === "linux" ? latest.linux : null) : null;
|
||||
if (newest === null || newest === undefined) return "current"; // nothing to compare with: don't cry wolf
|
||||
return (server.agentVersion ?? 1) < newest ? "behind" : "current";
|
||||
}
|
||||
|
||||
/** "v2", or "v1 or older" for one that has never said. */
|
||||
export function agentVersionWords(version: number | null): string {
|
||||
return version === null ? "v1 or older" : `v${version}`;
|
||||
}
|
||||
Reference in new issue
Block a user