Uname:Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 14.225.216.240  /  Your IP : 216.73.216.26
Web Server : nginx/1.20.1
System : Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64
User : taidh ( 1001)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/pts/st/assets/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/pts/st/assets/pts.firebase.js
(function ($) {
    $.ajaxSetup({
        headers: {
            "X-CSRF-TOKEN": jQuery('meta[name="_token"]').attr("content"),
        },
    });

    const messaging = firebase.messaging();
    // var Toast = Swal.mixin({
    //     toast: true,
    //     position: 'bottom-end',
    //     showConfirmButton: false,
    //     // timer: 3000
    // });
    // Toast.fire({
    //     title: 'fdsfdsfdsfsdfdsf',
    //     text: 'fdsfdsfdsfsdfsfsd',
    // })
    messaging.onMessage((payload) => {
        console.log('Message received. ', payload);
        Swal.fire({
            html: payload.data.web_template || payload.notification.body,
            position: 'bottom-end',
            showConfirmButton: false,
            timer: 5000
        })
        const notificationCont = jQuery('.notification-cont');
        const latestURL = notificationCont.data('url');
        if (!_.isEmpty(latestURL)) {

            delete payload.data.web_template;
            jQuery.ajax({
                url: latestURL,
                type: 'POST',
                data: payload,
                async: false,
                success: function (response) {
                    if (response?.html) {
                        notificationCont.removeClass('d-none');
                        jQuery('#notification-data').html(response.html);
                        jQuery('#notification-no').html(response.count_unread || 0);
                    } else {
                        notificationCont.addClass('d-none');
                    }
                },
                error: function () {
                }
            });
        }
    });

    function resetUI() {
        // Get registration token. Initially this makes a network call, once retrieved // subsequent calls to getToken will return from cache. 
        messaging.getToken({
            vapidKey: firebaseConfig.applicationServerKey
        }).then((currentToken) => {
            if (currentToken) {
                console.log(`currentToken: ${currentToken}`);
                sendTokenToServer(currentToken);
            } else {
                // Show permission request. 
                console.log('No registration token available. Request permission to generate one.');
                // Show permission UI. 
                updateUIForPushPermissionRequired();
                setTokenSentToServer(false);
            }
        }).catch((err) => {
            console.log('An error occurred while retrieving token. ', err);
            //showToken('Error retrieving registration token. ', err);
            setTokenSentToServer(false);
        });
    }

    // Send the registration token your application server, so that it can: // - send messages back to this app // - subscribe/unsubscribe the token from topics function 
    const sendTokenToServer = (currentToken) => {
        if (!isTokenSentToServer()) {
            if ((notificationURL || '') != '') {
                

                jQuery.ajax({
                    url: notificationURL,
                    type: 'POST',
                    data: {
                        token: currentToken,
                        device: "web",
                    },
                    async: false,
                    success: function (response) {
                        setTokenSentToServer(response.auth ?? false);
                    },
                    error: function () {
                    }
                });
            }
            
        } else {
            console.log('Token already sent to server so won\'t send it again ' + 'unless it changes');
        }
    }

    function isTokenSentToServer() {
        return window.localStorage.getItem('sentToServer') === '1';
    }

    function setTokenSentToServer(sent) {
        window.localStorage.setItem('sentToServer', sent ? '1' : '0');
    }

    function requestPermission() {
        dismissNotificationPopUp();
        Notification.requestPermission().then((permission) => {
            if (permission === 'granted') {
                console.log('Notification permission granted.');
                // TODO(developer): Retrieve a registration token for use with FCM. 
                // In many cases once an app has been granted notification permission, 
                // it should update its UI reflecting this. 
                resetUI();
            } else {
                console.log('Unable to get permission to notify.');
            }
        });
    }

    function deleteToken() {
        // Delete registration token. 
        messaging.getToken().then((currentToken) => {
            messaging.deleteToken(currentToken).then(() => {
                console.log('Token deleted.');
                setTokenSentToServer(false);
                // Once token is deleted update UI. 
                resetUI();
            }).catch((err) => {
                console.log('Unable to delete token. ', err);
            });
        }).catch((err) => {
            console.log('Error retrieving registration token. ', err);
            showToken('Error retrieving registration token. ', err);
        });
    }

    function updateUIForPushPermissionRequired() {
        if (Notification.permission != "granted") 
        {
            jQuery('#notificationPopUp').removeClass('d-none').slideDown("fast");
        }
        else requestPermission();
    }

    function dismissNotificationPopUp() {
        jQuery('#notificationPopUp').addClass('d-none');
    }

    updateUIForPushPermissionRequired();

    jQuery('body').on('click','#allowNotification', function(e){
        e.preventDefault();
        requestPermission();
    });

    jQuery('body').on('click','#blockNotification', function(e){
        e.preventDefault();
        dismissNotificationPopUp();
    })
})(jQuery);

Youez - 2016 - github.com/yon3zu
LinuXploit