From 935ad091297e40e1ea14f5302b7d59b19caa141d Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 31 Dec 2021 13:17:17 -0800 Subject: [PATCH] Web Power Switch operations are now logged. --- meshuser.js | 4 ++-- views/default.handlebars | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/meshuser.js b/meshuser.js index 9ba6d6ab..1b524b87 100644 --- a/meshuser.js +++ b/meshuser.js @@ -2902,7 +2902,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (node.mtype == 4) { // Send out an event to perform turn off command on the port //var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['devport-operation', 'server-users', user._id]); - var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'turnon', domain: domain.id, nolog: 1, portid: node.portid, porttype: node.porttype, portnum: node.portnum, meshid: node.meshid, mtype: node.mtype }; + const event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'turnon', domain: domain.id, portid: node.portid, porttype: node.porttype, portnum: node.portnum, meshid: node.meshid, mtype: node.mtype, msgid: 132, msg: "Turn on." }; parent.parent.DispatchEvent([ 'devport-operation' ], obj, event); return; } @@ -3072,7 +3072,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use if (node.mtype == 4) { // Send out an event to perform turn off command on the port //var targets = parent.CreateNodeDispatchTargets(node.meshid, node._id, ['devport-operation', 'server-users', user._id]); - var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'turnoff', domain: domain.id, nolog: 1, portid: node.portid, porttype: node.porttype, portnum: node.portnum, meshid: node.meshid, mtype: node.mtype }; + var event = { etype: 'node', userid: user._id, username: user.name, nodeid: node._id, action: 'turnoff', domain: domain.id, portid: node.portid, porttype: node.porttype, portnum: node.portnum, meshid: node.meshid, mtype: node.mtype, msgid: 133, msg: "Turn off." }; parent.parent.DispatchEvent([ 'devport-operation' ], obj, event); return; } diff --git a/views/default.handlebars b/views/default.handlebars index 48807a2d..74124586 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -13348,7 +13348,9 @@ 128: "Account created, name is {0}.", 129: "Removed account display name.", 130: "User notifications changed", - 131: "Added device share {0} with unlimited time." + 131: "Added device share {0} with unlimited time.", + 132: "Turn on.", + 133: "Turn off." }; // Highlights the device being hovered