From 53c7eae4d28764f205b4a7295799fe9fb694a71f Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 5 Jun 2018 13:28:07 -0700 Subject: [PATCH] Improved mobile app --- meshagent.js | 2 +- mpsserver.js | 18 +- package.json | 2 +- public/images/3bars-30.png | Bin 0 -> 414 bytes public/images/user-50.png | Bin 0 -> 2499 bytes views/default-mobile.handlebars | 453 ++++++++++++++++++++++++++++---- views/default.handlebars | 32 ++- 7 files changed, 442 insertions(+), 65 deletions(-) create mode 100644 public/images/3bars-30.png create mode 100644 public/images/user-50.png diff --git a/meshagent.js b/meshagent.js index 0cf2e548..81ac1973 100644 --- a/meshagent.js +++ b/meshagent.js @@ -467,7 +467,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { var cmdstr = JSON.stringify(command); for (var userid in obj.parent.wssessions) { // Find all connected users for this mesh and send the message var user = obj.parent.users[userid]; - if (user) { + if ((user != null) && (user.links != null)) { var rights = user.links[obj.dbMeshKey]; if (rights != null) { // TODO: Look at what rights are needed for message routing var sessions = obj.parent.wssessions[userid]; diff --git a/mpsserver.js b/mpsserver.js index e0c583a2..831374b5 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -135,7 +135,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { 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: domainid, intelamt: { user: '', pass: '', tls: 0 } }; + 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 } }; obj.db.Set(device); // Event the new node @@ -152,7 +152,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } else { // Node is already present var node = nodes[0]; - if (node.intelamt != undefined) { socket.tag.host = node.intelamt.host; } + if ((node.intelamt != undefined) && (node.intelamt.state == 2)) { socket.tag.host = node.intelamt.host; } } // Add the connection to the MPS connection list @@ -249,7 +249,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { 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 } }; + 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 @@ -266,7 +266,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { } else { // Node is already present var node = nodes[0]; - if (node.intelamt != undefined) { socket.tag.host = node.intelamt.host; } + if ((node.intelamt != undefined) && (node.intelamt.state == 2)) { socket.tag.host = node.intelamt.host; } } // Add the connection to the MPS connection list @@ -286,7 +286,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { // Node is present var node = nodes[0]; - if (node.intelamt != undefined) { socket.tag.host = node.intelamt.host; } + if ((node.intelamt != undefined) && (node.intelamt.state == 2)) { socket.tag.host = node.intelamt.host; } socket.tag.nodeid = node._id; socket.tag.meshid = mesh._id; socket.tag.connectTime = Date.now(); @@ -667,7 +667,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { obj.db.Get(socket.tag.nodeid, function (err, nodes) { if (nodes.length != 1) return; var node = nodes[0]; - if ((node.intelamt != undefined) && (node.intelamt.host == host)) return; + + // See if any changes need to be made + console.log(node.intelamt); + if ((node.intelamt != undefined) && (node.intelamt.host == host) && (node.name != '') && (node.intelamt.state == 2)) return; // Get the mesh for this device obj.db.Get(node.meshid, function (err, meshes) { @@ -681,9 +684,10 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { // Make the change & save if (node.intelamt == undefined) node.intelamt = {}; node.intelamt.host = host; + node.intelamt.state = 2; // Set the state to activated, since this is pretty obvious, we have a CIRA connection. if (node.name == '') { node.name = host.split('.')[0]; } obj.db.Set(node); - + // Event the node change event.msg = 'CIRA changed device ' + node.name + ' from mesh ' + mesh.name + ': ' + changes.join(', '); var node2 = common.Clone(node); diff --git a/package.json b/package.json index 22d130f8..18826cdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.1.7-x", + "version": "0.1.8-a", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/images/3bars-30.png b/public/images/3bars-30.png new file mode 100644 index 0000000000000000000000000000000000000000..c0e541029a9e5b285e5f1d5f53fe2041f85923fe GIT binary patch literal 414 zcmV;P0b%}$P)N2bZe?^J zG%heMIczh2P5=M_97#k$R7gwhma%FAK@f(g3L$|M!PdqHFd%sYA&r$qN*f#Nyg*(d zAXuabX)J957J`k951?)#Djaw_yL)h#gmj68{>2m$(oP!phmV8f;A3`YZkJ+WRO6hx zbN2bZe?^J zG%heMIczh2P5=N2K}keGRA@u(nd?)N=^4iT19tkQGwlaI`KbqOXFIMtD=I1yLLdnc z!a3of1VVy{1UcqFLO3XA2!s$0!2>9(auQwFRYW`s9>=!RnL7Q{S=(+qTWh~wy`Lv< zLV!5kPBF2ay=Sh;iT8Q$-+Nv6^Agzfef__e)9Ku-R;yFu{yvh?iQ8}eThV3*Jq#Y#JjX-Pb4BE_hRqfz1X*JAEKh7{LoDM z_eb&1ckYb9?%lgzI~ptaJ=nh!IVcmB4sGS< z=WmIK*!89~KMl9f9mk!C6SzZ&TDlp|Rt4%+-0g%9N6OrK==@&KM*9l_HtJ$UlPFv0Y5ckX`P zf?H#D%zI3j>oY*FmIZ6xuZW0<@PRy->^89GpMP}<&##}xvumSxeA!K|IC#Vs#~Uy| zYQ{Bp1uk_Kz)_WsqD%>D3lre1$$(6}&krIJ#Y_mxhQ1!n_7lhu0i5J8Prn=mb0`?d zY=;KZt$C|t(kA*rXnU>{mJ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)kHu9#z5ljdaql|sQ|aU zVBQFN?++D_x3HfnC0KfoZ@CpnVnFYJ+VD9^X*Fz*v+G`nZH0)f*CN(VPz^fBj75lR z3~-A@(B~G1@_~^H1jQ}_`<%Zf*O)VjJ>~xU2m=d*N*}1v3N370vF$LSu~-*tD|{`s z7Jxy;*A)p+>)rB3P?#+SMUUhzLF@T*-%gmofP7G-KqzvhRXF{|SBk^(QJl3%C$sBc z$5=FosUs+BAqNX|OTwJ;&(>kY)9YB9783fLfl4W6^1z*tL9GGH?5~{^PWyf<{dif1 z+^)YKW6p;cN<&ayw^pFMZZQZibOC?g7c(Bgz}XVEcYd$wDi7_y98@iaEz0JyGO<}R z8E4f(V9IGI>Aa?vQi-7_tcZXN$IWQf|N5Dx4zp#s096)m|PWuh*9) zHI__DZMs*i@#xxvI8dF712uX4IR_$8U)+3~hN89XTV+SNN7-HRsj%dSQxgQ2-(}jq zzba?Drpv5WHkPXCxtf5~(t4fxpu?{12;?DR3v&Pf N002ovPDHLkV1gdxtxEs^ literal 0 HcmV?d00001 diff --git a/views/default-mobile.handlebars b/views/default-mobile.handlebars index a2679a39..b0377f98 100644 --- a/views/default-mobile.handlebars +++ b/views/default-mobile.handlebars @@ -48,18 +48,30 @@ border-bottom-width: 1px; border-bottom-color: #DDDDDD; } + + .noselect { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + }
-
- {{{title}}} -
-
- {{{title2}}} +
+
+ {{{title}}} +
+
+ {{{title2}}} +
+
@@ -76,8 +88,48 @@ -