diff --git a/meshuser.js b/meshuser.js index 0eb9817d..30d50cf8 100644 --- a/meshuser.js +++ b/meshuser.js @@ -5554,12 +5554,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use for (var j in docs) { var nodeid = docs[j]._id.substring(2); if (LCs[nodeid] != null) { - delete docs[j]._id; - LCs[nodeid] = docs[j]; + LCs[nodeid] = docs[j].time; } } - console.log(LCs); + try { ws.send(JSON.stringify({ action: 'lastseen', lastconnects: LCs })); } catch (ex) { } }); }); } diff --git a/views/default.handlebars b/views/default.handlebars index 8ba5b988..b47fd4c1 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2291,6 +2291,14 @@ } break; } + case 'lastseen': { + var lcnodes = Object.keys(message.lastconnects); + for (var i in lcnodes) { + var lcnodeid = lcnodes[i]; + var node = getNodeFromId(lcnodeid); + if (node != null) { node.lastconnect = message.lastconnects[lcnodeid] } + } + } case 'msg': { // Check if this is a message from a node if (message.nodeid != null) {