1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

All JavaScript code is now 'strict'

This commit is contained in:
Ylian Saint-Hilaire 2018-08-27 12:24:15 -07:00
parent f6b6fe9506
commit 312b937e62
29 changed files with 129 additions and 78 deletions

View file

@ -6,6 +6,8 @@
* @version v0.0.1
*/
'use strict';
var AgentConnectCount = 0;
// Construct a MeshAgent object, called upon connection
@ -423,9 +425,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
// Process incoming agent JSON data
function processAgentData(msg) {
var str = msg.toString('utf8');
var str = msg.toString('utf8'), command = null;
if (str[0] == '{') {
try { command = JSON.parse(str) } catch (e) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str); return; } // If the command can't be parsed, ignore it.
try { command = JSON.parse(str) } catch (ex) { console.log('Unable to parse agent JSON (' + obj.remoteaddr + '): ' + str, ex); return; } // If the command can't be parsed, ignore it.
if (typeof command != 'object') { return; }
switch (command.action) {
case 'msg':
{