feat: add plugin hooks for compose, attachments, search, lifecycle, and routing

This commit is contained in:
Linus Rath
2026-05-02 21:27:56 +02:00
parent 5e096240b3
commit f970fd1822
10 changed files with 565 additions and 20 deletions
+10
View File
@@ -122,6 +122,7 @@ async function handlePush(event) {
async function handleNotificationClick(event) {
const data = event.notification.data || {};
const tag = event.notification.tag || "";
const targetUrl = buildClickUrl(data);
const allClients = await self.clients.matchAll({
@@ -129,6 +130,15 @@ async function handleNotificationClick(event) {
includeUncontrolled: true,
});
// Notify any in-app clients so plugins listening on toastHooks.onNotificationClick fire.
for (const client of allClients) {
try {
client.postMessage({ kind: "notificationclick", tag, data });
} catch (_) {
// Closed or detached client - ignore.
}
}
for (const client of allClients) {
// Reuse an existing tab whenever possible - users on desktop browsers
// get annoyed when each notification opens a fresh window.