mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added webpush to advanced config and schema.
This commit is contained in:
parent
7c7f78136a
commit
ddf78e325c
3 changed files with 13 additions and 3 deletions
|
@ -2,12 +2,12 @@
|
|||
self.addEventListener('push', function (event) {
|
||||
if (event.data == null) return;
|
||||
var json = event.data.json();
|
||||
const options = { body: json.body, icon: '/favicon-303x303.png', tag: json.url };
|
||||
const options = { body: json.body, icon: '/favicon-303x303.png', data: { url: json.url } };
|
||||
if (json.icon) { options.icon = '/images/notify/icons128-' + json.icon + '.png'; }
|
||||
self.registration.showNotification(json.title, options);
|
||||
event.waitUntil(self.registration.showNotification(json.title, options));
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
event.notification.close();
|
||||
if ((event.notification.tag != null) && (event.notification.tag != '')) { event.waitUntil(self.clients.openWindow(event.notification.tag)); }
|
||||
if ((event.notification.data.url != null) && (event.notification.data.url != '')) { event.waitUntil(self.clients.openWindow(event.notification.data.url)); }
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue