mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-27 15:45:53 -05:00
Added support for compressed MeshCore.js
This commit is contained in:
parent
fddf83ae0a
commit
1edb8f9662
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
agents/agents-new/MeshService.exe
Normal file
BIN
agents/agents-new/MeshService.exe
Normal file
Binary file not shown.
BIN
agents/agents-new/MeshService64.exe
Normal file
BIN
agents/agents-new/MeshService64.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshCmd-signed.exe
Normal file
BIN
agents/agents-old/MeshCmd-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshCmd64-signed.exe
Normal file
BIN
agents/agents-old/MeshCmd64-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService-signed.exe
Normal file
BIN
agents/agents-old/MeshService-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService.exe
Normal file
BIN
agents/agents-old/MeshService.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService64-signed.exe
Normal file
BIN
agents/agents-old/MeshService64-signed.exe
Normal file
Binary file not shown.
BIN
agents/agents-old/MeshService64.exe
Normal file
BIN
agents/agents-old/MeshService64.exe
Normal file
Binary file not shown.
10
meshagent.js
10
meshagent.js
@ -175,9 +175,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
parent.agentStats.clearingCoreCount++;
|
parent.agentStats.clearingCoreCount++;
|
||||||
parent.parent.debug('agent', "Clearing core");
|
parent.parent.debug('agent', "Clearing core");
|
||||||
} else {
|
} else {
|
||||||
// Update new core
|
// Setup task limiter options, this system limits how many tasks can run at the same time to spread the server load.
|
||||||
//obj.sendBinary(common.ShortToStr(10) + common.ShortToStr(0) + meshcorehash + parent.parent.defaultMeshCores[corename]); // MeshCommand_CoreModule, start core update
|
var taskLimiterOptions = { hash: meshcorehash, core: parent.parent.defaultMeshCores[corename], name: corename };
|
||||||
//parent.parent.debug('agent', 'Updating code ' + corename);
|
|
||||||
|
// If the agent supports compression, sent the core compressed.
|
||||||
|
if ((obj.agentInfo.capabilities & 0x80) && (parent.parent.defaultMeshCoresDeflate[corename])) { args.core = parent.parent.defaultMeshCoresDeflate[corename]; }
|
||||||
|
|
||||||
// Update new core with task limiting so not to flood the server. This is a high priority task.
|
// Update new core with task limiting so not to flood the server. This is a high priority task.
|
||||||
obj.agentCoreUpdatePending = true;
|
obj.agentCoreUpdatePending = true;
|
||||||
@ -193,7 +195,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
// This agent is probably disconnected, nothing to do.
|
// This agent is probably disconnected, nothing to do.
|
||||||
parent.parent.taskLimiter.completed(taskid);
|
parent.parent.taskLimiter.completed(taskid);
|
||||||
}
|
}
|
||||||
}, { hash: meshcorehash, core: parent.parent.defaultMeshCores[corename], name: corename }, 0);
|
}, taskLimiterOptions, 0);
|
||||||
}
|
}
|
||||||
obj.agentCoreCheck++;
|
obj.agentCoreCheck++;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
obj.certificateOperations = null;
|
obj.certificateOperations = null;
|
||||||
obj.defaultMeshCmd = null;
|
obj.defaultMeshCmd = null;
|
||||||
obj.defaultMeshCores = {};
|
obj.defaultMeshCores = {};
|
||||||
|
obj.defaultMeshCoresDeflate = {};
|
||||||
obj.defaultMeshCoresHash = {};
|
obj.defaultMeshCoresHash = {};
|
||||||
obj.meshAgentBinaries = {}; // Mesh Agent Binaries, Architecture type --> { hash:(sha384 hash), size:(binary size), path:(binary path) }
|
obj.meshAgentBinaries = {}; // Mesh Agent Binaries, Architecture type --> { hash:(sha384 hash), size:(binary size), path:(binary path) }
|
||||||
obj.meshAgentInstallScripts = {}; // Mesh Install Scripts, Script ID -- { hash:(sha384 hash), size:(binary size), path:(binary path) }
|
obj.meshAgentInstallScripts = {}; // Mesh Install Scripts, Script ID -- { hash:(sha384 hash), size:(binary size), path:(binary path) }
|
||||||
@ -1992,6 +1993,11 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
obj.debug('main', 'Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.');
|
obj.debug('main', 'Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.');
|
||||||
//console.log('Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.'); // DEBUG, Print the core size
|
//console.log('Core module ' + i + ' is ' + obj.defaultMeshCores[i].length + ' bytes.'); // DEBUG, Print the core size
|
||||||
//obj.fs.writeFile("C:\\temp\\" + i + ".js", obj.defaultMeshCores[i].substring(4)); // DEBUG, Write the core to file
|
//obj.fs.writeFile("C:\\temp\\" + i + ".js", obj.defaultMeshCores[i].substring(4)); // DEBUG, Write the core to file
|
||||||
|
|
||||||
|
// Compress the mesh cores with DEFLATE
|
||||||
|
var callback = function MeshCoreDeflateCb(err, buffer) { if (err == null) { obj.defaultMeshCoresDeflate[MeshCoreDeflateCb.i] = buffer; } }
|
||||||
|
callback.i = i;
|
||||||
|
require('zlib').deflate(obj.defaultMeshCores[i], { level: require('zlib').Z_BEST_COMPRESSION }, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user