From f96afcc6b62251b7537c5d966d9adc18358e677c Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Wed, 8 Apr 2020 19:16:33 -0700 Subject: [PATCH] Simplified MeshCore version logic --- agents/meshcore.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index 85dc53fe..cff452d7 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -280,7 +280,8 @@ function createMeshCore(agent) { */ // MeshAgent JavaScript Core Module. This code is sent to and running on the mesh agent. - 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 + 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 + // Get the operating system description string try { require('os').name().then(function (v) { meshCoreObj.osdesc = v; }); } catch (ex) { } @@ -2389,7 +2390,7 @@ function createMeshCore(agent) { break; } case 'info': { // Return information about the agent and agent core module - 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 + '.'; + 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 + '.'; if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; } if (meshCoreObj.osdesc) { response += '\r\nOS: ' + meshCoreObj.osdesc + '.'; } response += '\r\nModules: ' + addedModules.join(', ') + '.';