PageSourceSearch

https://church.chat/firebase-messaging-sw.js

js church.chat collected 2026-10-09 05:22:58 UTC 2,450 bytes, 61 lines download raw bytes

1// Auto-generated — do not edit
2importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js');
3importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js');
4firebase.initializeApp({
5  "apiKey": "AIzaSyAyp4LeiOJ-d6i70I-UGYsZh8plNYUx9Ps",
6  "authDomain": "church.chat",
7  "projectId": "involv-d3339",
8  "storageBucket": "involv-d3339.appspot.com",
9  "messagingSenderId": "90761754846",
10  "appId": "1:90761754846:web:10f24bc4fecaebd9f6ea4f",
11  "measurementId": "G-H6K1P6001S"
12});
13const messaging = firebase.messaging();
14
15messaging.onBackgroundMessage((payload) => {
16  const notificationTitle = payload.notification?.title || 'ChurchChat';
17  const route = payload.data?.route || payload.data?.url ||
18    (payload.data?.groupId ? '/inbox/' + payload.data.groupId : '/');
19  self.registration.showNotification(notificationTitle, {
20    body: payload.notification?.body || 'You have a new message',
21    icon: '/apple-touch-icon.png',
22    badge: '/icons/icon-72.webp',
23    tag: payload.data?.groupId || payload.data?.type || 'churchchat-notification',
24    data: { ...payload.data, url: route, route },
25    requireInteraction: false,
26    actions: [{ action: 'view', title: 'View' }, { action: 'close', title: 'Close' }],
27  });
28});
29
30function resolveNotificationUrl(data) {
31  if (!data) return '/';
32  if (data.route) return data.route;
33  if (data.url) return data.url;
34  if (data.groupId) return '/inbox/' + data.groupId;
35  return '/';
36}
37
38function openOrFocusApp(relativePath) {
39  const p = relativePath.startsWith('/') ? relativePath : '/' + relativePath;
40  const fullUrl = self.location.origin + p;
41  return clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
42    for (const client of clientList) {
43      if (client.url.includes(self.location.origin) && 'focus' in client) {
44        client.focus();
45        if (client.navigate) return client.navigate(p);
46        client.postMessage({ type: 'NAVIGATE', url: p });
47        return;
48      }
49    }
50    if (clients.openWindow) return clients.openWindow(fullUrl);
51  });
52}
53
54self.addEventListener('notificationclick', (event) => {
55  event.notification.close();
56  if (event.action === 'close') return;
57  event.waitUntil(openOrFocusApp(resolveNotificationUrl(event.notification.data || {})));
58});
59
60self.addEventListener('install', () => self.skipWaiting());
61self.addEventListener('activate', (event) => event.waitUntil(clients.claim()));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.