OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/09/2025 11:18:49 AM
rwxr-xr-x
📄
app.js
1.07 KB
08/12/2024 10:32:50 AM
rw-r--r--
📄
composer.json
66 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
composer.lock
93.17 KB
08/12/2024 10:32:50 AM
rw-r--r--
📁
config
-
08/12/2024 10:32:51 AM
rwxr-xr-x
📄
db.php
285 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
debug.log
0 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
firebase-messaging-sw.js
1.08 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
index.php
2.03 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
logo.png
49.4 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
save-token.php
773 bytes
08/12/2024 10:32:51 AM
rw-r--r--
📄
send-notification.php
1.5 KB
08/12/2024 10:32:51 AM
rw-r--r--
📁
vendor
-
08/12/2024 10:33:06 AM
rwxr-xr-x
Editing: app.js
Close
// app.js // Import necessary Firebase components import { getMessaging, getToken } from "https://www.gstatic.com/firebasejs/9.22.1/firebase-messaging.js"; // Initialize Firebase (make sure to use the correct initialization from index.php) // The Firebase initialization should be included in index.php only if it isn't elsewhere. const messaging = getMessaging(); // Function to handle token retrieval and save it export async function subscribeUser() { try { const token = await getToken(messaging, { vapidKey: 'BBH31S4UH9FkvWlSB8euuHi9aft10kZ8xOoKXooev14bV7FIxv5n3VKAzGDDKMffaz9rsdNECeMkVB_74xWSEhk' }); console.log('Token:', token); if (token) { // Send the token to your server await fetch('/save-token.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ token }), }); } } catch (error) { console.error('Error getting token:', error); } } // Ensure app.js is loaded and the subscribeUser function is correctly triggered.