diff options
| author | Kit La Touche <kit@transneptune.net> | 2025-10-08 22:27:51 -0400 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2025-10-08 22:27:51 -0400 |
| commit | 13e05d7e048c62845466b0be41402985d7f3f38b (patch) | |
| tree | 783c77b44fbed8dd99c88aa4461f4722ca6ec681 /ui/lib/components | |
| parent | 9ca03b7044b820a1fe4b6ab8fc690fb6c5312c73 (diff) | |
Adjust endpoints to match server expectationswip/push-notif
Diffstat (limited to 'ui/lib/components')
| -rw-r--r-- | ui/lib/components/NotificationSettings.svelte | 6 |
1 files changed, 4 insertions, 2 deletions
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, |
