From a3733eae6067e4da8179b184e5df6208ab4ac731 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 13 Dec 2023 22:23:56 +0200 Subject: [PATCH] fuck youuuuuuuuuuuuuuuu --- src/sw.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/sw.js b/src/sw.js index 3e1f99bb8..8a54e20c1 100644 --- a/src/sw.js +++ b/src/sw.js @@ -59,21 +59,19 @@ const setSettings = async () => { } const showPushNotification = async (event) => { - const activeClients = await getWindowClients() + // const activeClients = await getWindowClients() await setSettings() // Only show push notifications if all tabs/windows are closed - if (activeClients.length === 0) { - const data = event.data.json() + const data = event.data.json() - const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}` - const notification = await fetch(url, { headers: { Authorization: 'Bearer ' + data.access_token } }) - const notificationJson = await notification.json() - const parsedNotification = parseNotification(notificationJson) + const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}` + const notification = await fetch(url, { headers: { Authorization: 'Bearer ' + data.access_token } }) + const notificationJson = await notification.json() + const parsedNotification = parseNotification(notificationJson) - const res = prepareNotificationObject(parsedNotification, i18n) + const res = prepareNotificationObject(parsedNotification, i18n) - return self.registration.showNotification(res.title, res) - } + return self.registration.showNotification(res.title, res) } self.addEventListener('push', async (event) => {