1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

More work on device connect/disconnect email notifications.

This commit is contained in:
Ylian Saint-Hilaire 2021-10-11 09:38:30 -07:00
parent 8696e1c12f
commit 20b17b64b7
3 changed files with 36 additions and 1 deletions

View file

@ -5663,6 +5663,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
'dropallcira': [serverUserCommandDropAllCira, ""],
'dupagents': [serverUserCommandDupAgents, ""],
'email': [serverUserCommandEmail, ""],
'emailnotifications': [serverUserCommandEmailNotifications, ""],
'firebase': [serverUserCommandFirebase, ""],
'heapdump': [serverUserCommandHeapDump, ""],
'heapdump2': [serverUserCommandHeapDump2, ""],
@ -6053,6 +6054,22 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
}
function serverUserCommandEmailNotifications(cmdData) {
if (domain.mailserver == null) {
cmdData.result = "No email service enabled.";
} else {
var x = '';
for (var userid in domain.mailserver.deviceNotifications) {
x += userid + '\r\n';
for (var nodeid in domain.mailserver.deviceNotifications[userid].nodes) {
const info = domain.mailserver.deviceNotifications[userid].nodes[nodeid];
x += ' ' + info.mn + ', ' + info.nn + ', c:' + (info.c ? info.c : 0) + ', d:' + (info.d ? info.d : 0) + '\r\n';
}
}
cmdData.result = ((x == '')?'None':x);
}
}
function serverUserCommandLe(cmdData) {
if (parent.parent.letsencrypt == null) {
cmdData.result = "Let's Encrypt not in use.";