diff --git a/mpsserver.js b/mpsserver.js index 34a6cf04..40e71ced 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -146,10 +146,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { // Fetch the mesh obj.db.Get(socket.tag.meshid, function (err, meshes) { - if (meshes.length == 1) { + if (meshes.length === 1) { var mesh = meshes[0]; obj.db.Get(socket.tag.nodeid, function (err, nodes) { - if (nodes.length == 0) { + if (nodes.length !== 1) { if (mesh.mtype == 1) { // Node is not in the database, add it. Credentials will be empty until added by the user. var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, host: null, domain: domainid, intelamt: { user: '', pass: '', tls: 0, state: 2 } }; @@ -261,23 +261,16 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { socket.tag.connectTime = Date.now(); obj.db.Get(socket.tag.nodeid, function (err, nodes) { - if (nodes.length == 0) { - if (mesh.mtype == 1) { - // Node is not in the database, add it. Credentials will be empty until added by the user. - var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, host: null, domain: mesh.domain, intelamt: { user: '', pass: '', tls: 0, state: 2 } }; - obj.db.Set(device); + if (nodes.length !== 1) { + // Node is not in the database, add it. Credentials will be empty until added by the user. + var device = { type: 'node', mtype: 1, _id: socket.tag.nodeid, meshid: socket.tag.meshid, name: socket.tag.name, host: null, domain: mesh.domain, intelamt: { user: '', pass: '', tls: 0, state: 2 } }; + obj.db.Set(device); - // Event the new node - var device2 = common.Clone(device); - if (device2.intelamt.pass != null) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this. - var change = 'CIRA added device ' + socket.tag.name + ' to group ' + mesh.name; - obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: mesh.domain }); - } else { - // New CIRA connection for unknown node, disconnect. - console.log('CIRA connection for unknown node with incorrect group type. meshid: ' + socket.tag.meshid); - socket.end(); - return; - } + // Event the new node + var device2 = common.Clone(device); + if (device2.intelamt.pass != null) delete device2.intelamt.pass; // Remove the Intel AMT password before eventing this. + var change = 'CIRA added device ' + socket.tag.name + ' to group ' + mesh.name; + obj.parent.DispatchEvent(['*', socket.tag.meshid], obj, { etype: 'node', action: 'addnode', node: device2, msg: change, domain: mesh.domain }); } else { // Node is already present var node = nodes[0]; @@ -292,7 +285,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } else if (mesh.mtype == 2) { // If this is a agent mesh, search the mesh for this device UUID // Intel AMT GUID (socket.tag.SystemId) will be used to search the node obj.db.getAmtUuidNode(mesh._id, socket.tag.SystemId, function (err, nodes) { // TODO: May need to optimize this request with indexes - if (nodes.length == 0) { + if (nodes.length !== 1) { // New CIRA connection for unknown node, disconnect. console.log('CIRA connection for unknown node. groupid: ' + mesh._id + ', uuid: ' + socket.tag.SystemId); socket.end(); @@ -688,7 +681,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { // Change the device obj.db.Get(socket.tag.nodeid, function (err, nodes) { - if (nodes.length != 1) return; + if (nodes.length !== 1) return; var node = nodes[0]; // See if any changes need to be made @@ -696,7 +689,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { // Get the mesh for this device obj.db.Get(node.meshid, function (err, meshes) { - if (meshes.length != 1) return; + if (meshes.length !== 1) return; var mesh = meshes[0]; // Ready the node change event diff --git a/package.json b/package.json index 1bad58e1..c6a56206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.3.3-j", + "version": "0.3.3-k", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/styles/style.css b/public/styles/style.css index b58ed975..b6eecccb 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -32,7 +32,7 @@ body { -ms-grid-rows: 66px 24px 1fr 45px; grid-template-rows: 66px 24px auto 45px; -ms-grid-columns: 90px 1fr; - grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr)); + /*grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr));*/ grid-template-areas: "header header" "nav nav" "content content" "footer footer"; } @@ -40,7 +40,7 @@ body { -ms-grid-rows: 66px 24px 1fr 45px; grid-template-rows: 66px 24px auto 45px; -ms-grid-columns: 90px 1fr; - grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr)); + /*grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr));*/ grid-template-areas: "header header" "nav nav" "content content" "footer footer"; } @@ -48,7 +48,7 @@ body { -ms-grid-rows: 66px minmax(24px, max-content) 1fr 45px; grid-template-rows: 66px minmax(24px, max-content) auto 45px; -ms-grid-columns: 90px 1fr; - grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr)); + /*grid-template-columns: 90px repeat(auto-fit, minmax(900px, 1fr));*/ grid-template-areas: "header header" "nav nav" "content content" "footer footer"; } @@ -101,7 +101,7 @@ body { background-position-y: 0px; background-attachment: initial; background-repeat: no-repeat; - width: 960px; + /*width: 960px;*/ height: 66px; } diff --git a/views/default-min.handlebars b/views/default-min.handlebars index f181e863..4c845294 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/login-min.handlebars b/views/login-min.handlebars index ac2ab582..2c3ee8e5 100644 --- a/views/login-min.handlebars +++ b/views/login-min.handlebars @@ -1 +1 @@ - {{{title}}} - Login
{{{title}}}
{{{title2}}}

Welcome


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

Welcome


\ No newline at end of file diff --git a/views/messenger-min.handlebars b/views/messenger-min.handlebars index 31e96d59..afed2cda 100644 --- a/views/messenger-min.handlebars +++ b/views/messenger-min.handlebars @@ -1 +1 @@ - MeshMessenger
MeshMessenger
\ No newline at end of file + MeshMessenger
MeshMessenger
\ No newline at end of file