403Webshell
Server IP : 14.225.204.176  /  Your IP : 216.73.216.6
Web Server : nginx/1.24.0
System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64
User : root ( 0)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/php/supportboard/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/php/supportboard//sw.js
'use strict';

/*
 * ==========================================================
 * SERVICE WORKER
 * ==========================================================
 *
 * Service Worker of Support Board admin area
 *
*/

const SB_CACHE_NAME = 'sb-3-3-9';
const SB_OFFLINE = 'resources/pwa/offline.html';
var sb_push_link;
var sb_push_conversation_id;
var sb_push_user_conversation_id;

importScripts('https://js.pusher.com/beams/service-worker.js');

self.addEventListener('install', (event) => {
    event.waitUntil((async () => {
        const cache = await caches.open(SB_CACHE_NAME);
        await cache.add(new Request(SB_OFFLINE, { cache: 'reload' }));
    })());
});

self.addEventListener('activate', (event) => {
    event.waitUntil((async () => {
        if ('navigationPreload' in self.registration) {
            await self.registration.navigationPreload.enable();
        }
    })());
    self.clients.claim();
});

self.addEventListener('fetch', (event) => {
    if (event.request.mode === 'navigate') {
        event.respondWith((async () => {
            try {
                const preloadResponse = await event.preloadResponse;
                if (preloadResponse) {
                    return preloadResponse;
                }
                const networkResponse = await fetch(event.request);
                return networkResponse;
            } catch (error) {
                const cache = await caches.open(SB_CACHE_NAME);
                const cachedResponse = await cache.match(SB_OFFLINE);
                return cachedResponse;
            }
        })());
    }
});

// Pusher
PusherPushNotifications.onNotificationReceived = ({ pushEvent, payload }) => {
    sb_push_link = payload.notification.deep_link;
    sb_push_conversation_id = payload.data.conversation_id;
    sb_push_user_conversation_id = payload.data.user_id;
    pushEvent.waitUntil(self.registration.showNotification(payload.notification.title, { body: payload.notification.body, icon: payload.notification.icon, data: payload.data }));
};

self.addEventListener('notificationclick', function (event) {
    event.notification.close();
    event.waitUntil(clients.matchAll({
        type: 'window',
        includeUncontrolled: true
    }).then((clientList) => {
        for (var i = 0; i < clientList.length; i++) {
            if (clientList[i].url.split('?')[0] == sb_push_link) {
                clientList[i].postMessage({ 'conversation_id': sb_push_conversation_id, 'user_id': sb_push_user_conversation_id });
                return clientList[i].focus();
            }
        }
        if (sb_push_link && clients.openWindow) return clients.openWindow(sb_push_link + '?conversation=' + sb_push_conversation_id);
    }));
});

Youez - 2016 - github.com/yon3zu
LinuXploit