diff --git a/assets/public/custom/pushMessages.js b/assets/public/custom/pushMessages.js index f152886a..662158de 100644 --- a/assets/public/custom/pushMessages.js +++ b/assets/public/custom/pushMessages.js @@ -42,7 +42,7 @@ async function registerPush(publicKey) { if (window.IS_IOS && !window.IS_STANDALONE) { throw new Error( - "On iOS, notifications require adding this site to the Home Screen." + "On iOS, notifications require adding this site to the Home Screen" ); } @@ -51,16 +51,14 @@ async function registerPush(publicKey) { throw new Error("Notification permission not granted"); } - const registration = await navigator.serviceWorker.register( - "/assets/custom/serviceWorker.js", - { scope: "/" } - ); + const registration = await navigator.serviceWorker.register( + "/assets/custom/serviceWorker.js" + ); let subscription = await registration.pushManager.getSubscription(); if (!subscription) { const applicationServerKey = urlBase64ToUint8Array(publicKey); - subscription = await registration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey @@ -84,6 +82,6 @@ async function registerPush(publicKey) { if (!response.ok) { const text = await response.text(); - throw new Error(`Failed to register push: ${text}`); + throw new Error(text); } } \ No newline at end of file