Simplified MeshCore version logic
Bryan Roe committed
Apr 8, 2020 at 19:16 UTC
78ea736459f2e8b324858f10c45bb7e82bc2cdb8
1 file changed
+3
-2
agents/meshcore.js
+3
-2
@@ -280,7 +280,8 @@ function createMeshCore(agent) {
280
*/
281
282
// MeshAgent JavaScript Core Module. This code is sent to and running on the mesh agent.
283
- var meshCoreObj = { action: 'coreinfo', value: 'MeshCore v6', caps: 14 }; // Capability bitmask: 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console, 16 = JavaScript, 32 = Temporary Agent, 64 = Recovery Agent
283
+ var meshCoreObj = { action: 'coreinfo', value: (require('MeshAgent').coreHash ? ('MeshCore CRC[' + crc32c(require('MeshAgent').coreHash) + ']') : ('MeshCore v6')), caps: 14 }; // Capability bitmask: 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console, 16 = JavaScript, 32 = Temporary Agent, 64 = Recovery Agent
284
+
285
286
// Get the operating system description string
287
try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; }); } catch (ex) { }
@@ -2389,7 +2390,7 @@ function createMeshCore(agent) {
2390
break;
2391
}
2392
case 'info': { // Return information about the agent and agent core module
2392
- response = 'Current Core: ' + (require('MeshAgent').coreHash ? ('CRC[' + crc32c(require('MeshAgent').coreHash) + ']') : (meshCoreObj.value)) + '\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
2393
+ response = 'Current Core: ' + meshCoreObj.value + '\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
2394
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
2395
if (meshCoreObj.osdesc) { response += '\r\nOS: ' + meshCoreObj.osdesc + '.'; }
2396
response += '\r\nModules: ' + addedModules.join(', ') + '.';