From 3b0625a823393443feab7ad6565797f3f1ff08e2 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 30 Jun 2026 10:35:57 +0545 Subject: [PATCH] feat(templates): add logout link URL, hide in HTMX responses --- templates/base.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/base.html b/templates/base.html index 0d5ba58..98b267a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -293,12 +293,12 @@ return cookieValue; } + {% if vapid_public_key %} + const vapidPublicKey = "{{ vapid_public_key }}"; function doPushSubscribe(reg) { - const vapidKey = "{{ vapid_public_key }}"; - if (!vapidKey) return; reg.pushManager.subscribe({ userVisibleOnly: true, - applicationServerKey: vapidKey, + applicationServerKey: vapidPublicKey, }).then(sub => { fetch('/api/notifications/push/subscribe/', { method: 'POST', @@ -312,8 +312,7 @@ }).catch(() => {}); } - const vapidPublicKey = "{{ vapid_public_key }}"; - if (vapidPublicKey && 'serviceWorker' in navigator && 'PushManager' in window) { + if ('serviceWorker' in navigator && 'PushManager' in window && Notification.permission !== 'denied') { navigator.serviceWorker.register('/sw.js').then(reg => { if (Notification.permission === 'granted') { doPushSubscribe(reg); @@ -339,6 +338,7 @@ localStorage.setItem('push_declined', '1'); document.getElementById('push-prompt').classList.add('hidden'); }; + {% endif %} {% block extra_scripts %}{% endblock %}