security hardening, team invites, granular locking, view counts, board subscriptions, scheduled changelog, mentions, recovery codes, accessibility and hover states
This commit is contained in:
22
packages/web/public/sw.js
Normal file
22
packages/web/public/sw.js
Normal file
@@ -0,0 +1,22 @@
|
||||
self.addEventListener("push", (event) => {
|
||||
let data = { title: "Echoboard", body: "New activity on your watched content" };
|
||||
try {
|
||||
data = event.data.json();
|
||||
} catch {}
|
||||
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(data.title, {
|
||||
body: data.body,
|
||||
icon: data.icon || "/favicon.ico",
|
||||
data: { url: data.url },
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const raw = event.notification.data?.url || "/";
|
||||
const safe = new URL(raw, self.location.origin);
|
||||
const url = safe.origin === self.location.origin ? safe.href : "/";
|
||||
event.waitUntil(clients.openWindow(url));
|
||||
});
|
||||
Reference in New Issue
Block a user