Only the VAPID key (Web Push certificate) is still REPLACE_ME; the push guard now keys off vapidKey so nothing prompts until it's set. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
21 lines
784 B
JavaScript
21 lines
784 B
JavaScript
// Background handler for FCM web push. Keep the config in sync with
|
|
// window.KC_FIREBASE in index.html (a service worker can't read window).
|
|
importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-app-compat.js');
|
|
importScripts('https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging-compat.js');
|
|
|
|
firebase.initializeApp({
|
|
apiKey: 'AIzaSyDxBpdmW8lUHSuix--3AsWJScGQy9o3G_M',
|
|
projectId: 'konfi-castle-app',
|
|
messagingSenderId: '307226979593',
|
|
appId: '1:307226979593:web:66898b2c78b2d110ef77d8',
|
|
});
|
|
|
|
firebase.messaging().onBackgroundMessage(function (payload) {
|
|
const n = payload.notification || {};
|
|
self.registration.showNotification(n.title || 'KC-App', {
|
|
body: n.body || '',
|
|
icon: '/icons/Icon-192.png',
|
|
data: payload.data || {},
|
|
});
|
|
});
|