Dependencies beyond servers, web push, inventory auto-fill with QR labels, Windows agent health

- Dependencies: servers and integrations can depend on each other; alerts are folded under the root cause, and a failure explained by something down isn't announced
- Web push: hand-written VAPID and RFC 8291 encryption, per-device subscriptions, a fifth notification channel, service worker handlers
- Inventory: maker/model/serial from the agents fill blank fields, "Refresh from agent", QR label printing and ?asset= deep links
- Windows agent (v4) reports failed services, disk health, Storage Spaces pools and hardware identity; Linux agent (v5) reports hardware identity

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 18:53:30 +02:00
1 parent 5cc51c57de
commit ec9c2f73f0
55 files changed
+12553 -65

No files matched your search

+2 -2
View File
@@ -336,7 +336,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
.get()
.then((res) => {
const s = res.settings;
setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.smtp.enabled || s.webhook.enabled);
setNotifyConfigured(s.gotify.enabled || s.ntfy.enabled || s.smtp.enabled || s.webhook.enabled || !!s.webPush?.enabled);
})
.catch(() => setNotifyConfigured(null));
api.users
@@ -589,7 +589,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{ id: "server", title: "Add a server and install its agent", description: "The agent reports scheduled tasks, disks, memory and open ports, and lets the app tell when a server goes quiet.", to: "/servers", action: "Add a server", done: (serverSummary?.total ?? 0) > 0 },
{ id: "dns", title: "Connect a DNS provider", description: "See your zones and records, and have names matched to servers.", to: "/dns", action: "Connect", done: (dnsStats?.totalProviders ?? 0) > 0 },
{ id: "secret", title: "Track something that expires", description: "An API token, a certificate or a password — you're warned before it runs out.", to: "/secrets", action: "Add one", done: (secrets?.length ?? 0) > 0 },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email or a webhook, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "notify", title: "Choose how you'll be told about problems", description: "Gotify, ntfy, email, a webhook or push to your phone, with the checks you want.", to: "/settings/notifications", action: "Set up", done: notifyConfigured === true },
{ id: "people", title: "Let someone else in (optional)", description: "Others sign in with Authentik and appear under Users; you decide their role.", to: "/users", action: "Open Users", done: (userCount ?? 0) > 1 },
];
+199
View File
@@ -0,0 +1,199 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type CurrentUser, type DependenciesResponse, type DependencyNode } from "../api/client";
import { ErrorNotice } from "../components/Notice";
import { BlockSkeleton } from "../components/Skeleton";
import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors";
import { toast } from "../utils/toast";
const TYPE_LABELS = { server: "Server", integration: "Integration" } as const;
const linkTo = (type: string, id: number) => (type === "server" ? `/servers/${id}` : "/integrations");
/** The options of a node picker, grouped by what they are. */
function NodeSelect({ id, label, nodes, value, onChange }: { id: string; label: string; nodes: DependencyNode[]; value: string; onChange: (key: string) => void }) {
return (
<>
<label className="form-label" htmlFor={id}>
{label}
</label>
<select id={id} className="form-select" value={value} onChange={(e) => onChange(e.target.value)}>
<option value="">— choose —</option>
{(["server", "integration"] as const).map((type) => (
<optgroup key={type} label={`${TYPE_LABELS[type]}s`}>
{nodes
.filter((n) => n.type === type)
.map((n) => (
<option key={n.key} value={n.key}>
{n.name}
</option>
))}
</optgroup>
))}
</select>
</>
);
}
/**
* What needs what. When something is down, whatever depends on it is down too, and only the one that matters should raise the alarm — so the
* alerts of the things that need it are folded under it, like a guest under its host.
*/
export default function Dependencies({ user }: { user: CurrentUser }) {
const canEdit = user.role === "admin" || user.role === "operator";
const [data, setData] = useState<DependenciesResponse | null>(null);
const [error, setError] = useState<string | null>(null);
const [from, setFrom] = useState("");
const [to, setTo] = useState("");
const [busy, setBusy] = useState(false);
function load() {
api.dependencies
.list()
.then(setData)
.catch((err) => setError(readableError(err)));
}
useEffect(load, []);
const parse = (key: string) => {
const [type, id] = key.split(":");
return { type: type as "server" | "integration", id: Number(id) };
};
async function add(e: React.FormEvent) {
e.preventDefault();
if (!from || !to) return;
setBusy(true);
setError(null);
try {
const f = parse(from);
const t = parse(to);
await api.dependencies.create({ fromType: f.type, fromId: f.id, toType: t.type, toId: t.id });
toast.success("Saved.");
setFrom("");
setTo("");
load();
} catch (err) {
setError(readableError(err));
} finally {
setBusy(false);
}
}
async function remove(d: DependenciesResponse["dependencies"][number]) {
if (!(await confirmDialog({ title: "Remove a dependency", message: `${d.from.name} no longer needs ${d.to.name}?`, confirmLabel: "Remove", danger: true }))) return;
try {
await api.dependencies.remove(d.id);
load();
} catch (err) {
setError(readableError(err));
}
}
return (
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Dependencies</h2>
</div>
<p className="text-secondary">
Say what needs what: Gitea needs the server it is installed on; a Proxmox guest needs the Proxmox it runs on. When the thing that is needed is down, what needs it is down too — and its alert is
held back under the first one on the Alerts page instead of adding to the noise. A service that was down for its own reasons still alerts once what it needs is back.
</p>
<ErrorNotice error={error} />
{canEdit && (
<form className="card mb-3" onSubmit={add}>
<div className="card-header">
<h3 className="card-title">Add a dependency</h3>
</div>
<div className="card-body row g-3 align-items-end">
<div className="col-md-5">
<NodeSelect id="dep-from" label="This…" nodes={data?.nodes ?? []} value={from} onChange={setFrom} />
</div>
<div className="col-md-5">
<NodeSelect id="dep-to" label="…needs this" nodes={(data?.nodes ?? []).filter((n) => n.key !== from)} value={to} onChange={setTo} />
</div>
<div className="col-md-2">
<button type="submit" className="btn btn-primary w-100" disabled={busy || !from || !to}>
{busy ? "Saving…" : "Add"}
</button>
</div>
</div>
</form>
)}
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Written here</h3>
</div>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<thead>
<tr>
<th>This</th>
<th>needs</th>
{canEdit && <th className="w-1">Actions</th>}
</tr>
</thead>
<tbody>
{data === null && !error && (
<tr>
<td colSpan={canEdit ? 3 : 2}>
<BlockSkeleton lines={2} />
</td>
</tr>
)}
{data?.dependencies.map((d) => (
<tr key={d.id}>
<td>
<Link to={linkTo(d.from.type, d.from.id)}>{d.from.name}</Link> <span className="text-secondary small">{TYPE_LABELS[d.from.type].toLowerCase()}</span>
</td>
<td>
<Link to={linkTo(d.to.type, d.to.id)}>{d.to.name}</Link> <span className="text-secondary small">{TYPE_LABELS[d.to.type].toLowerCase()}</span>
</td>
{canEdit && (
<td>
<button className="btn btn-sm btn-outline-danger" onClick={() => void remove(d)}>
Remove
</button>
</td>
)}
</tr>
))}
{data && data.dependencies.length === 0 && (
<tr>
<td colSpan={canEdit ? 3 : 2} className="text-secondary text-center">
Nothing written yet.{canEdit ? " Add the first above." : ""}
</td>
</tr>
)}
</tbody>
</table>
</div>
</div>
{data && data.runsOn.length > 0 && (
<div className="card">
<div className="card-header">
<h3 className="card-title">Servers that run on servers</h3>
</div>
<div className="card-body text-secondary small pb-0">These are set on each server (&ldquo;runs on&rdquo;), or worked out from the Proxmox node it is a guest of. They count here too.</div>
<div className="table-responsive">
<table className="table table-vcenter card-table">
<tbody>
{data.runsOn.map((r) => (
<tr key={`${r.from.key}>${r.to.key}`}>
<td>{r.from.name}</td>
<td className="text-secondary">runs on</td>
<td>{r.to.name}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
)}
</>
);
}
+91 -5
View File
@@ -102,6 +102,9 @@ export default function Inventory({ user }: { user: CurrentUser }) {
const [params, setParams] = useSearchParams();
const kind = (KINDS as string[]).includes(params.get("kind") ?? "") ? (params.get("kind") as AssetKind) : "";
// A scanned label comes here with ?asset=ID: that one piece of hardware is shown first.
const focusId = /^\d+$/.test(params.get("asset") ?? "") ? Number(params.get("asset")) : null;
const focused = focusId === null ? null : (assets ?? []).find((a) => a.id === focusId) ?? null;
function load() {
api.inventory
@@ -158,6 +161,19 @@ export default function Inventory({ user }: { user: CurrentUser }) {
}
}
async function refreshFromAgent(a: Asset) {
const d = a.agent?.differs ?? {};
const lines = (Object.keys(d) as (keyof typeof d)[]).map((k) => `${k}: "${a[k] ?? ""}" becomes "${d[k]}"`);
if (!(await confirmDialog({ title: "Take over what the agent says", message: `${a.name}: ${lines.join("; ")}.`, confirmLabel: "Replace" }))) return;
try {
await api.inventory.refreshFromAgent(a.id);
toast.success("Updated from the agent.");
load();
} catch (err) {
setError(readableError(err));
}
}
async function saveConfig(e: React.FormEvent) {
e.preventDefault();
setError(null);
@@ -180,6 +196,13 @@ export default function Inventory({ user }: { user: CurrentUser }) {
);
}
// A name that is a server's name (or holds it) is probably that server.
const suggestion = (() => {
const n = draft?.name.trim().toLowerCase();
if (!n) return null;
return servers.find((s) => s.name.toLowerCase() === n) ?? servers.find((s) => s.name.length >= 3 && n.includes(s.name.toLowerCase())) ?? null;
})();
const set = <K extends keyof Draft>(key: K, value: Draft[K]) => setDraft((d) => (d ? { ...d, [key]: value } : d));
const cards: { label: string; value: string; note?: string; color: string }[] = [
@@ -198,14 +221,60 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<>
<div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Inventory</h2>
{canEdit && !draft && (
<button className="btn btn-primary ms-auto" onClick={() => setDraft({ ...EMPTY })}>
Add hardware
</button>
)}
<div className="ms-auto d-flex gap-2">
<Link to="/inventory/labels" className="btn">
Print labels
</Link>
{canEdit && !draft && (
<button className="btn btn-primary" onClick={() => setDraft({ ...EMPTY })}>
Add hardware
</button>
)}
</div>
</div>
<ErrorNotice error={error} />
{focused && (
<div className="card mb-3 border-primary">
<div className="card-header">
<h3 className="card-title">{focused.name}</h3>
<div className="card-actions">
<button className="btn btn-sm" onClick={() => setParams((p) => { const n = new URLSearchParams(p); n.delete("asset"); return n; }, { replace: true })}>
Close
</button>
</div>
</div>
<div className="card-body">
<dl className="row mb-0">
{([
["Kind", KIND_LABELS[focused.kind]],
["Maker and model", [focused.manufacturer, focused.model].filter(Boolean).join(" ") || null],
["Serial number", focused.serial],
["Where", [focused.location, focused.rackUnit].filter(Boolean).join(" · ") || null],
["Bought", focused.purchaseDate],
["Warranty until", focused.warrantyUntil],
["Power draw", focused.powerWatts === null ? null : `${focused.powerWatts} W`],
["Notes", focused.notes],
] as [string, string | null][]).map(([label, value]) => (
<div className="col-md-6 d-flex" key={label}>
<dt className="col-5 text-secondary fw-normal">{label}</dt>
<dd className="col-7">{value ?? "—"}</dd>
</div>
))}
{focused.server && (
<div className="col-md-6 d-flex">
<dt className="col-5 text-secondary fw-normal">Is the server</dt>
<dd className="col-7">
<Link to={`/servers/${focused.server.id}`}>{focused.server.name}</Link>
</dd>
</div>
)}
</dl>
</div>
</div>
)}
{focusId !== null && assets !== null && !focused && <div className="alert alert-warning">That piece of hardware isn't in the inventory any more.</div>}
<div className="row row-cards mb-3">
{cards.map((c) => (
<div className="col-6 col-lg-3" key={c.label}>
@@ -256,6 +325,15 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</option>
))}
</select>
{draft.serverId === "" && suggestion && (
<div className="form-hint small mt-1">
Looks like <strong>{suggestion.name}</strong>.{" "}
<button type="button" className="btn btn-link btn-sm p-0 align-baseline" onClick={() => set("serverId", String(suggestion.id))}>
Link it
</button>
</div>
)}
{draft.serverId !== "" && <div className="form-hint text-secondary small mt-1">Blank maker, model and serial number are filled in from the server's agent when you save.</div>}
</div>
<div className="col-md-4">
<label className="form-label" htmlFor="inv-maker">
@@ -398,6 +476,14 @@ export default function Inventory({ user }: { user: CurrentUser }) {
is <Link to={`/servers/${a.server.id}`}>{a.server.name}</Link>
</div>
)}
{canEdit && a.agent && Object.keys(a.agent.differs).length > 0 && (
<div className="small text-secondary">
The agent says {Object.entries(a.agent.differs).map(([k, v]) => `${k === "manufacturer" ? "maker" : k === "serial" ? "serial number" : k} ${v}`).join(", ")}.{" "}
<button type="button" className="btn btn-link btn-sm p-0 align-baseline" onClick={() => void refreshFromAgent(a)}>
Refresh from agent
</button>
</div>
)}
</td>
<td>{KIND_LABELS[a.kind]}</td>
<td>
+143
View File
@@ -0,0 +1,143 @@
import { useEffect, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import { api, type Asset } from "../api/client";
import QrCode from "../components/QrCode";
import { ErrorNotice } from "../components/Notice";
import { BlockSkeleton } from "../components/Skeleton";
import { readableError } from "../utils/errors";
import { KIND_LABELS } from "../utils/inventory";
/** Label sizes, in millimetres, as they are stuck on: a rack-mount sticker, a standard address label, a larger one for a shelf. */
const SIZES = {
small: { label: "Small (50 × 25 mm)", w: 50, h: 25, qr: 21 },
medium: { label: "Medium (70 × 35 mm)", w: 70, h: 35, qr: 29 },
large: { label: "Large (90 × 50 mm)", w: 90, h: 50, qr: 42 },
} as const;
type SizeKey = keyof typeof SIZES;
/** What a label's code opens: that piece of hardware in the inventory. */
export const labelUrl = (id: number) => `${window.location.origin}/inventory?asset=${id}`;
/**
* Labels for the hardware, to print on a sheet of stickers (or plain paper and cut out): a QR code that opens the entry in the inventory,
* and the name, what it is, its serial number and where it sits in words for when a phone isn't to hand.
*/
export default function InventoryLabels() {
const [assets, setAssets] = useState<Asset[] | null>(null);
const [error, setError] = useState<string | null>(null);
const [chosen, setChosen] = useState<Set<number>>(new Set());
const [size, setSize] = useState<SizeKey>("medium");
const [showBorder, setShowBorder] = useState(true);
useEffect(() => {
api.inventory
.list()
.then((res) => {
setAssets(res.assets);
setChosen(new Set(res.assets.map((a) => a.id)));
})
.catch((err) => setError(readableError(err)));
}, []);
const picked = useMemo(() => (assets ?? []).filter((a) => chosen.has(a.id)), [assets, chosen]);
const dims = SIZES[size];
const toggle = (id: number) =>
setChosen((prev) => {
const next = new Set(prev);
if (next.has(id)) next.delete(id);
else next.add(id);
return next;
});
return (
<>
<div className="d-flex align-items-center mb-3 no-print">
<h2 className="page-title mb-0">Labels</h2>
<div className="ms-auto d-flex gap-2">
<Link to="/inventory" className="btn">
Back to the inventory
</Link>
<button className="btn btn-primary" disabled={picked.length === 0} onClick={() => window.print()}>
Print {picked.length} label{picked.length === 1 ? "" : "s"}
</button>
</div>
</div>
<ErrorNotice error={error} />
{/* The page's size is the label sheet's own: set here so the print dialog starts out right. */}
<style>{`@media print { @page { margin: 8mm; } }`}</style>
<div className="row g-3 no-print mb-3">
<div className="col-lg-4">
<div className="card">
<div className="card-body">
<label className="form-label" htmlFor="label-size">
Size
</label>
<select id="label-size" className="form-select mb-3" value={size} onChange={(e) => setSize(e.target.value as SizeKey)}>
{(Object.keys(SIZES) as SizeKey[]).map((k) => (
<option key={k} value={k}>
{SIZES[k].label}
</option>
))}
</select>
<label className="form-check">
<input type="checkbox" className="form-check-input" checked={showBorder} onChange={(e) => setShowBorder(e.target.checked)} />
<span className="form-check-label">Draw a border (handy for cutting plain paper)</span>
</label>
<div className="text-secondary small mt-3">Each code opens the entry in the inventory, so whoever scans it must be signed in here. Printed sizes are exact only with "Scale: 100%" in the print dialog.</div>
</div>
</div>
</div>
<div className="col-lg-8">
<div className="card">
<div className="card-header">
<h3 className="card-title">Which hardware</h3>
<div className="card-actions btn-list">
<button className="btn btn-sm" onClick={() => setChosen(new Set((assets ?? []).map((a) => a.id)))}>
All
</button>
<button className="btn btn-sm" onClick={() => setChosen(new Set())}>
None
</button>
</div>
</div>
<div className="card-body" style={{ maxHeight: "16rem", overflowY: "auto" }}>
{assets === null && !error && <BlockSkeleton lines={3} />}
{assets?.length === 0 && <div className="text-secondary">Nothing in the inventory yet.</div>}
<div className="row">
{assets?.map((a) => (
<div className="col-md-6" key={a.id}>
<label className="form-check">
<input type="checkbox" className="form-check-input" checked={chosen.has(a.id)} onChange={() => toggle(a.id)} />
<span className="form-check-label">
{a.name} <span className="text-secondary small">{KIND_LABELS[a.kind]}</span>
</span>
</label>
</div>
))}
</div>
</div>
</div>
</div>
</div>
<div className="label-sheet" aria-label="Labels to print">
{picked.map((a) => (
<div key={a.id} className={`asset-label ${showBorder ? "asset-label-border" : ""}`} style={{ width: `${dims.w}mm`, height: `${dims.h}mm` }}>
<div className="asset-label-qr" style={{ width: `${dims.qr}mm`, height: `${dims.qr}mm` }}>
<QrCode text={labelUrl(a.id)} label={`Opens ${a.name} in the inventory`} />
</div>
<div className="asset-label-text">
<div className="asset-label-name">{a.name}</div>
{(a.manufacturer || a.model) && <div>{[a.manufacturer, a.model].filter(Boolean).join(" ")}</div>}
{a.serial && <div>S/N {a.serial}</div>}
{(a.location || a.rackUnit) && <div>{[a.location, a.rackUnit].filter(Boolean).join(" · ")}</div>}
<div className="asset-label-id">#{a.id}</div>
</div>
</div>
))}
</div>
</>
);
}
+1 -1
View File
@@ -7,7 +7,7 @@ import { formatAgo } from "../utils/duration";
import { readableError } from "../utils/errors";
import { ErrorNotice } from "../components/Notice";
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", smtp: "email (SMTP)", webhook: "webhook" } as const;
const CHANNEL_LABELS = { gotify: "Gotify", ntfy: "ntfy", smtp: "email (SMTP)", webhook: "webhook", webPush: "web push" } as const;
/** SQLite timestamps ("2026-09-26 04:07:21") are UTC without a zone marker. */
function parseTime(value: string): Date {
@@ -7,6 +7,7 @@ import {
type NtfySettings,
type SmtpSettings,
type WebhookSettings,
type WebPushSettings,
type NotificationEvents,
type DigestSettings,
type QuietHoursSettings,
@@ -15,6 +16,7 @@ import {
import { readableError } from "../../utils/errors";
import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import PushDevices from "../../components/PushDevices";
const TIMEZONES = [
"UTC",
@@ -43,6 +45,7 @@ const DEFAULT_GOTIFY: GotifySettings = { enabled: false, url: "", token: "", pri
const DEFAULT_NTFY: NtfySettings = { enabled: false, url: "https://ntfy.sh", topic: "", token: "", priority: 3 };
const DEFAULT_SMTP: SmtpSettings = { enabled: false, host: "", port: 587, secure: false, username: "", password: "", from: "", to: "" };
const DEFAULT_WEBHOOK: WebhookSettings = { enabled: false, url: "", secret: "" };
const DEFAULT_WEBPUSH: WebPushSettings = { enabled: false, contact: "" };
const DEFAULT_NOTIFICATIONS: NotificationEvents = {
dnsAdd: true,
dnsUpdate: true,
@@ -219,6 +222,9 @@ export default function NotificationSettings() {
const [ntfy, setNtfy] = useState<NtfySettings>(DEFAULT_NTFY);
const [smtp, setSmtp] = useState<SmtpSettings>(DEFAULT_SMTP);
const [webhook, setWebhook] = useState<WebhookSettings>(DEFAULT_WEBHOOK);
const [webPush, setWebPush] = useState<WebPushSettings>(DEFAULT_WEBPUSH);
// Whether push is on as saved: people can only add their browsers once the server knows it is on.
const [webPushSaved, setWebPushSaved] = useState(false);
const [notifications, setNotifications] = useState<NotificationEvents>(DEFAULT_NOTIFICATIONS);
const [quietHours, setQuietHours] = useState<QuietHoursSettings>(DEFAULT_QUIET_HOURS);
const [healthChecks, setHealthChecks] = useState<HealthCheckSettings>(DEFAULT_HEALTH_CHECKS);
@@ -239,7 +245,7 @@ export default function NotificationSettings() {
const [testingWebhook, setTestingWebhook] = useState(false);
const [testWebhookResult, setTestWebhookResult] = useState<TestResult>(null);
const snapshot = JSON.stringify({ gotify, ntfy, smtp, webhook, notifications, quietHours, healthChecks, digest });
const snapshot = JSON.stringify({ gotify, ntfy, smtp, webhook, webPush, notifications, quietHours, healthChecks, digest });
const dirty = baseline !== null && snapshot !== baseline;
useEffect(() => {
@@ -251,12 +257,15 @@ export default function NotificationSettings() {
setNtfy(s.ntfy);
setSmtp(s.smtp);
setWebhook(s.webhook);
const wp = s.webPush ?? DEFAULT_WEBPUSH;
setWebPush(wp);
setWebPushSaved(wp.enabled);
setNotifications(s.notifications);
setQuietHours(s.quietHours);
setHealthChecks(s.healthChecks);
const d = s.digest ?? DEFAULT_DIGEST;
setDigest(d);
setBaseline(JSON.stringify({ gotify: s.gotify, ntfy: s.ntfy, smtp: s.smtp, webhook: s.webhook, notifications: s.notifications, quietHours: s.quietHours, healthChecks: s.healthChecks, digest: d }));
setBaseline(JSON.stringify({ gotify: s.gotify, ntfy: s.ntfy, smtp: s.smtp, webhook: s.webhook, webPush: wp, notifications: s.notifications, quietHours: s.quietHours, healthChecks: s.healthChecks, digest: d }));
})
.catch((err) => setLoadError(err instanceof Error ? err.message : String(err)))
.finally(() => setLoading(false));
@@ -303,8 +312,9 @@ export default function NotificationSettings() {
setSaveError(null);
setSaved(false);
try {
await api.settings.update({ gotify, ntfy, smtp, webhook, notifications, quietHours, healthChecks, digest });
await api.settings.update({ gotify, ntfy, smtp, webhook, webPush, notifications, quietHours, healthChecks, digest });
setBaseline(snapshot);
setWebPushSaved(webPush.enabled);
setSaved(true);
setTimeout(() => setSaved(false), 3000);
} catch (err) {
@@ -412,7 +422,7 @@ export default function NotificationSettings() {
const ntfyComplete = !!(ntfy.url && ntfy.topic);
const smtpComplete = !!(smtp.host && smtp.from && smtp.to);
const webhookComplete = !!webhook.url;
const channelsOn = [gotify.enabled && gotifyComplete, ntfy.enabled && ntfyComplete, smtp.enabled && smtpComplete, webhook.enabled && webhookComplete].filter(Boolean).length;
const channelsOn = [gotify.enabled && gotifyComplete, ntfy.enabled && ntfyComplete, smtp.enabled && smtpComplete, webhook.enabled && webhookComplete, webPush.enabled].filter(Boolean).length;
const toggle = (key: EventKey, label: string) => <EventToggle key={key} label={label} checked={notifications[key]} onChange={(on) => setNotifications((n) => ({ ...n, [key]: on }))} />;
const dailyChecksEnabled = notifications.secretCheck || notifications.tailscaleKeyCheck || notifications.dockerUpdateCheck || notifications.proxmoxBackupCheck || notifications.pbsVerificationCheck || notifications.domainExpiryCheck;
@@ -614,6 +624,30 @@ export default function NotificationSettings() {
</button>
<TestBadge result={testWebhookResult} />
</ChannelRow>
<ChannelRow
name="Phone and browser"
description={<>Push notifications to a phone or browser that asks for them, with no app or account. They need this page to be opened over https.</>}
enabled={webPush.enabled}
onToggle={(on) => setWebPush((w) => ({ ...w, enabled: on }))}
complete
summary="Web push"
open={openChannel === "webpush"}
onOpen={() => setOpenChannel(openChannel === "webpush" ? null : "webpush")}
>
<div className="mb-3">
<label className="form-label">Contact (optional)</label>
<input
className="form-control"
maxLength={200}
placeholder="you@example.com"
value={webPush.contact}
onChange={(e) => setWebPush((w) => ({ ...w, contact: e.target.value }))}
/>
<div className="form-hint text-secondary small">Given to the browsers&rsquo; push services (Google, Mozilla, Apple) so they can reach you if this misbehaves. An email address or an https address.</div>
</div>
<PushDevices serverEnabled={webPushSaved} />
</ChannelRow>
</div>
{/* ── What to send ── */}