ffdksgdpokg

This commit is contained in:
murdle 2025-12-21 16:29:23 +02:00
parent 51c9e38d12
commit ac6b282fdf

View File

@ -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);
}
}