PageSourceSearch

https://www.ginigen.ai/sw.js

js ginigen.ai collected 2026-10-05 16:09:41 UTC 2,576 bytes, 94 lines download raw bytes

1/**
2 * Service Worker for HugwartsBanana Push Notifications
3 */
4
5// eslint-disable-next-line no-undef
6self.addEventListener('install', (event) => {
7  console.log('[ServiceWorker] Install');
8  // eslint-disable-next-line no-undef
9  self.skipWaiting();
10});
11
12// eslint-disable-next-line no-undef
13self.addEventListener('activate', (event) => {
14  console.log('[ServiceWorker] Activate');
15  // eslint-disable-next-line no-undef
16  event.waitUntil(self.clients.claim());
17});
18
19// Handle push notifications
20// eslint-disable-next-line no-undef
21self.addEventListener('push', (event) => {
22  console.log('[ServiceWorker] Push received');
23
24  let data = {
25    title: '지니젠 스튜디오',
26    body: '새로운 알림이 있습니다!',
27    icon: '/icons/icon-192x192.png',
28    badge: '/icons/badge-72x72.png',
29    tag: 'default',
30    data: { url: '/' },
31  };
32
33  try {
34    if (event.data) {
35      const payload = event.data.json();
36      data = { ...data, ...payload };
37    }
38  } catch (error) {
39    console.error('[ServiceWorker] Error parsing push data:', error);
40  }
41
42  const options = {
43    body: data.body,
44    icon: data.icon,
45    badge: data.badge,
46    tag: data.tag,
47    data: data.data,
48    vibrate: [100, 50, 100],
49    requireInteraction: false,
50    actions: [
51      { action: 'open', title: '열기' },
52      { action: 'close', title: '닫기' },
53    ],
54  };
55
56  // eslint-disable-next-line no-undef
57  event.waitUntil(
58    // eslint-disable-next-line no-undef
59    self.registration.showNotification(data.title, options)
60  );
61});
62
63// Handle notification click
64// eslint-disable-next-line no-undef
65self.addEventListener('notificationclick', (event) => {
66  console.log('[ServiceWorker] Notification clicked:', event.action);
67
68  event.notification.close();
69
70  if (event.action === 'close') {
71    return;
72  }
73
74  const urlToOpen = event.notification.data?.url || '/';
75
76  // eslint-disable-next-line no-undef
77  event.waitUntil(
78    // eslint-disable-next-line no-undef
79    self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
80      // If already open, focus
81      for (const client of clientList) {
82        if (client.url.includes(urlToOpen) && 'focus' in client) {
83          return client.focus();
84        }
85      }
86      // Otherwise open new window
87      // eslint-disable-next-line no-undef
88      if (self.clients.openWindow) {
89        // eslint-disable-next-line no-undef
90        return self.clients.openWindow(urlToOpen);
91      }
92    })
93  );
94});

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.