From 13e05d7e048c62845466b0be41402985d7f3f38b Mon Sep 17 00:00:00 2001 From: Kit La Touche Date: Wed, 8 Oct 2025 22:27:51 -0400 Subject: Adjust endpoints to match server expectations --- ui/lib/components/NotificationSettings.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ui/lib/components') diff --git a/ui/lib/components/NotificationSettings.svelte b/ui/lib/components/NotificationSettings.svelte index 94acb37..99432c4 100644 --- a/ui/lib/components/NotificationSettings.svelte +++ b/ui/lib/components/NotificationSettings.svelte @@ -6,21 +6,23 @@ let subscriptionJson = $state(null); function doSubscribe() { + let vapid; navigator.serviceWorker.ready .then(async (registration) => { // TODO: Get vapid key from remote.state instead: const response = await fetch('/api/vapid'); // and if we fail to get it? const vapidPublicKey = await response.text(); - const convertedVapidKey = vapidPublicKey; + vapid = vapidPublicKey; return registration.pushManager.subscribe({ userVisibleOnly: true, - applicationServerKey: convertedVapidKey, + applicationServerKey: vapid, }); }) .then((subscription) => { const subJson = subscription.toJSON(); subscriptionJson = { + vapid, endpoint: subJson.endpoint, p256dh: subJson.keys.p256dh, auth: subJson.keys.auth, -- cgit v1.2.3