Added webpush to advanced config and schema.
This commit is contained in:
parent
7c7f78136a
commit
ddf78e325c
|
@ -65,6 +65,15 @@
|
|||
"npmPath": { "type": "string" },
|
||||
"npmProxy": { "type": "string", "format": "uri" },
|
||||
"allowHighQualityDesktop": { "type": "boolean", "default": true },
|
||||
"webPush": {
|
||||
"type": "object",
|
||||
"description": "When set with a valid email address, enables the MeshCentral web push notification feature. Allows administrators to send browser notifications to users even if they are not looking at the MeshCentral web site.",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"email": { "type": "string", "description": "Server administrator email given to the FireFox and Chrome push notification services." }
|
||||
},
|
||||
"required": [ "email" ]
|
||||
},
|
||||
"publicPushNotifications": { "type": "boolean", "default": false, "description": "When true, this server uses MeshCentral.com a push notification relay for Android notifications. Push notifications work even if the Android app is not open." },
|
||||
"desktopMultiplex": { "type": "boolean", "default": false, "description": "When true, enabled a server modules that efficiently splits a remote desktop stream to multiple browsers. Also allows slow browsers to not slow down the session for fast ones, this comes at the cost of extra server memory and processing for all remote desktop sessions." },
|
||||
"userAllowedIP": { "type": [ "string", "array" ] },
|
||||
|
|
|
@ -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)); }
|
||||
});
|
|
@ -51,6 +51,7 @@
|
|||
"_npmPath": "c:\\npm.exe",
|
||||
"_npmProxy": "http://1.2.3.4:80",
|
||||
"_allowHighQualityDesktop": true,
|
||||
"_webPush": { "email": "xxxxx@xxxxx.com" },
|
||||
"_publicPushNotifications": true,
|
||||
"_desktopMultiplex": true,
|
||||
"_userAllowedIP": "127.0.0.1,192.168.1.0/24",
|
||||
|
|
Loading…
Reference in New Issue