diff --git a/meshagent.js b/meshagent.js index 45498310..d7e58fa7 100644 --- a/meshagent.js +++ b/meshagent.js @@ -44,7 +44,6 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { // Disconnect this agent obj.close = function (arg) { - obj.authenticated = -1; if ((arg == 1) || (arg == null)) { try { ws.close(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket if (arg == 2) { try { ws._socket._parent.end(); if (obj.nodeid != null) { parent.parent.debug('agent', 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Hard close, close the TCP socket // If arg == 3, don't communicate with this agent anymore, but don't disconnect (Duplicate agent). @@ -81,9 +80,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } } else { // Update the last connect time - if (obj.authenticated == 2) { db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport }); } + if (obj.authenticated == 2) { db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport, cause: 1 }); } } + // Set this agent as no longer authenticated + obj.authenticated = -1; + // If we where updating the agent, clean that up. if (obj.agentUpdate != null) { if (obj.agentUpdate.fd) { try { parent.fs.close(obj.agentUpdate.fd); } catch (ex) { } } @@ -682,7 +684,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { // Mark when this device connected obj.connectTime = Date.now(); - db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport }); + db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport, cause: 1 }); // Device already exists, look if changes have occured var changes = [], change = 0, log = 0; @@ -743,7 +745,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { // Mark when this device connected obj.connectTime = Date.now(); - db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport }); + db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport, cause: 1 }); // This node does not exist, create it. var device = { type: 'node', mtype: mesh.mtype, _id: obj.dbNodeKey, icon: obj.agentInfo.platformType, meshid: obj.dbMeshKey, name: obj.agentInfo.computerName, rname: obj.agentInfo.computerName, domain: domain.id, agent: { ver: obj.agentInfo.agentVersion, id: obj.agentInfo.agentId, caps: obj.agentInfo.capabilities }, host: null }; diff --git a/package.json b/package.json index f7cf3e00..62c4ac79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.1-u", + "version": "0.4.1-v", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 9bf81382..59fc8798 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index cb43c827..096cafee 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -7183,14 +7183,14 @@ if (serverinfo.consent & 0x0010) { Q('d20flag4').checked = true; } if (serverinfo.consent & 0x0004) { Q('d20flag5').checked = true; } if (serverinfo.consent & 0x0020) { Q('d20flag6').checked = true; } - if (serverinfo.consent & 0x0040) { Q('d20flag7').checked = true; } + if (debugmode) { if (serverinfo.consent & 0x0040) { Q('d20flag7').checked = true; } } QE('d20flag1', !(serverinfo.consent & 0x0001)); QE('d20flag2', !(serverinfo.consent & 0x0008)); QE('d20flag3', !(serverinfo.consent & 0x0002)); QE('d20flag4', !(serverinfo.consent & 0x0010)); QE('d20flag5', !(serverinfo.consent & 0x0004)); QE('d20flag6', !(serverinfo.consent & 0x0020)); - QE('d20flag7', !(serverinfo.consent & 0x0040)); + if (debugmode) { QE('d20flag7', !(serverinfo.consent & 0x0040)); } } } @@ -7202,7 +7202,7 @@ if (Q('d20flag4').checked) { consent += 0x0010; } if (Q('d20flag5').checked) { consent += 0x0004; } if (Q('d20flag6').checked) { consent += 0x0020; } - if (Q('d20flag7').checked) { consent += 0x0040; } + if (debugmode) { if (Q('d20flag7').checked) { consent += 0x0040; } } meshserver.send({ action: 'editmesh', meshid: currentMesh._id, consent: consent }); }