add missing conn to getsysinfo for meshctrl and new Agent Status for meshctrl #7617
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Feb 12, 2026 at 15:00 UTC
bd53ba20cf513e03b5ef187100df9a3ec5c6d8c9
2 files changed
+24
-2
meshctrl.js
+2
-1
@@ -2894,7 +2894,7 @@ function displayDeviceInfo(sysinfo, lastconnect, network, nodes) {
2894
//console.log('displayDeviceInfo', sysinfo, lastconnect, network, nodes);
2895
2896
// Fetch the node information
2897
- var node = null;;
2897
+ var node = null;
2898
if (sysinfo != null && (sysinfo.node != null)) {
2899
// Node information came with system information
2900
node = sysinfo.node;
@@ -2971,6 +2971,7 @@ function displayDeviceInfo(sysinfo, lastconnect, network, nodes) {
2971
} else {
2972
if (node.lastconnect) { output["Last agent connection"] = new Date(node.lastconnect).toLocaleString(); outputCount++; }
2973
}
2974
+ output["Agent status"] = (node.conn & 1) != 0 ? "Connected now" : "Offline"; outputCount++;
2975
if (node.lastaddr) {
2976
var splitip = node.lastaddr.split(':');
2977
if (splitip.length > 2) {
meshuser.js
+22
-1
@@ -6522,7 +6522,28 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
6522
for (var i in doc.hardware.windows.volumes) { delete doc.hardware.windows.volumes[i].recoveryPassword; }
6523
}
6524
6525
- if (command.nodeinfo === true) { doc.node = node; doc.rights = rights; }
6525
+ if (command.nodeinfo === true) {
6526
+ doc.node = node;
6527
+ doc.rights = rights;
6528
+ // Remove any connectivity and power state information, that should not be in the database anyway.
6529
+ // TODO: Find why these are sometimes saved in the db.
6530
+ if (doc.node.conn != null) { delete doc.node.conn; }
6531
+ if (doc.node.pwr != null) { delete doc.node.pwr; }
6532
+ if (doc.node.agct != null) { delete doc.node.agct; }
6533
+ if (doc.node.cict != null) { delete doc.node.cict; }
6534
+ // Add the connection state
6535
+ var state = parent.parent.GetConnectivityState(doc.nodeid);
6536
+ if (state) {
6537
+ doc.node.conn = state.connectivity;
6538
+ doc.node.pwr = state.powerState;
6539
+ if ((state.connectivity & 1) != 0) { var agent = parent.wsagents[doc.nodeid]; if (agent != null) { doc.node.agct = agent.connectTime; } }
6540
+ // Use the connection time of the CIRA/Relay connection
6541
+ if ((state.connectivity & 2) != 0) {
6542
+ var ciraConnection = parent.parent.mpsserver.GetConnectionToNode(doc.nodeid, null, true);
6543
+ if ((ciraConnection != null) && (ciraConnection.tag != null)) { doc.node.cict = ciraConnection.tag.connectTime; }
6544
+ }
6545
+ }
6546
+ }
6547
obj.send(doc);
6548
} else {
6549
obj.send({ action: 'getsysinfo', nodeid: node._id, tag: command.tag, noinfo: true, result: 'Invalid device id' });