logging
This commit is contained in:
2
.env
2
.env
@ -57,5 +57,5 @@ GMAIL_EMAIL_APP_PASS=
|
|||||||
TELEGRAM_BOT=false
|
TELEGRAM_BOT=false
|
||||||
TELEGRAM_BOT_TOKEN=7050075088:AAH6VRpNCyQd9x9sW6CLm6q0q4ibUgYBfnM
|
TELEGRAM_BOT_TOKEN=7050075088:AAH6VRpNCyQd9x9sW6CLm6q0q4ibUgYBfnM
|
||||||
|
|
||||||
VAPID_PUBLIC_KEY=BGxXJ0jdsQ4ihE7zp8mxrBO-QPSjeEtO9aCtPoMTuxc1VLW0OfRIt-DYinK9ekjTl2w-j0eQbeprIyBCpmmfciI
|
NEXT_PUBLIC_VAPID_PUBLIC_KEY=BGxXJ0jdsQ4ihE7zp8mxrBO-QPSjeEtO9aCtPoMTuxc1VLW0OfRIt-DYinK9ekjTl2w-j0eQbeprIyBCpmmfciI
|
||||||
VAPID_PRIVATE_KEY=VXHu2NgcyM4J4w3O4grkS_0yLwWHCvVKDJexyBjqgx0
|
VAPID_PRIVATE_KEY=VXHu2NgcyM4J4w3O4grkS_0yLwWHCvVKDJexyBjqgx0
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
console.log('Service Worker Loaded...')
|
||||||
|
|
||||||
self.addEventListener('push', function (event) {
|
self.addEventListener('push', function (event) {
|
||||||
|
console.log('Push message', event)
|
||||||
|
if (!(self.Notification && self.Notification.permission === 'granted')) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const data = JSON.parse(event.data.text())
|
const data = JSON.parse(event.data.text())
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
registration.showNotification(data.title, {
|
registration.showNotification(data.title, {
|
||||||
@ -11,6 +17,7 @@ self.addEventListener('push', function (event) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.addEventListener('notificationclick', function (event) {
|
self.addEventListener('notificationclick', function (event) {
|
||||||
|
console.log('Notification click: tag', event.notification.tag)
|
||||||
event.notification.close()
|
event.notification.close()
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function (clientList) {
|
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function (clientList) {
|
||||||
|
Reference in New Issue
Block a user