Restore from Gitea ZIP snapshot (12.08.2026) after full instance reinstall
Git history was lost when the previous Gitea instance was wiped and reinstalled due to an unresolved corruption bug — this commit is the last known-good file content, exported before the reinstall. Prior commit history is not recoverable through this path.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// Web Push service worker. Deliberately minimal — no offline caching, no
|
||||
// asset interception. Its only job is to keep receiving push events even
|
||||
// when the page's own tab is frozen or closed, and turn them into an OS
|
||||
// notification.
|
||||
|
||||
self.addEventListener("push", (event) => {
|
||||
let payload = { title: "top-tickets", body: "", url: "/dashboard" };
|
||||
try {
|
||||
if (event.data) payload = { ...payload, ...event.data.json() };
|
||||
} catch {
|
||||
// malformed payload — fall back to the generic notification above
|
||||
}
|
||||
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(payload.title, {
|
||||
body: payload.body,
|
||||
icon: "/icon.svg",
|
||||
data: { url: payload.url },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const url = event.notification.data && event.notification.data.url ? event.notification.data.url : "/dashboard";
|
||||
|
||||
event.waitUntil(
|
||||
(async () => {
|
||||
const clientsList = await self.clients.matchAll({ type: "window", includeUncontrolled: true });
|
||||
const existing = clientsList.find((c) => "focus" in c);
|
||||
if (existing) {
|
||||
await existing.navigate(url);
|
||||
await existing.focus();
|
||||
return;
|
||||
}
|
||||
await self.clients.openWindow(url);
|
||||
})(),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user