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:
1 parent
5cc51c57de
commit
ec9c2f73f0
55 files changed
+12553
-65
No files matched your search
@@ -6,3 +6,38 @@
|
||||
self.addEventListener("install", () => self.skipWaiting());
|
||||
self.addEventListener("activate", (event) => event.waitUntil(self.clients.claim()));
|
||||
self.addEventListener("fetch", () => {});
|
||||
|
||||
// Push notifications (Settings > Notifications). The message arrives encrypted for this browser only and is read here; a tap opens the app
|
||||
// at the page it names, reusing a window that is already open.
|
||||
self.addEventListener("push", (event) => {
|
||||
let data = {};
|
||||
try {
|
||||
data = event.data ? event.data.json() : {};
|
||||
} catch {
|
||||
data = { body: event.data ? event.data.text() : "" };
|
||||
}
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(data.title || "Homelab Manager", {
|
||||
body: data.body || "",
|
||||
icon: "/icon-192.png",
|
||||
badge: "/favicon-32.png",
|
||||
tag: data.tag || undefined,
|
||||
data: { url: typeof data.url === "string" && data.url.startsWith("/") ? data.url : "/alerts" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const target = new URL((event.notification.data && event.notification.data.url) || "/alerts", self.location.origin).href;
|
||||
event.waitUntil(
|
||||
self.clients.matchAll({ type: "window", includeUncontrolled: true }).then((windows) => {
|
||||
for (const w of windows) {
|
||||
if (new URL(w.url).origin === self.location.origin && "focus" in w) {
|
||||
return w.focus().then(() => ("navigate" in w ? w.navigate(target) : undefined));
|
||||
}
|
||||
}
|
||||
return self.clients.openWindow(target);
|
||||
}),
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user