Added MeshAgent ZIP links when compressed version is available.

This commit is contained in:
Ylian Saint-Hilaire 2021-08-17 15:32:58 -07:00
parent 348cd452ff
commit fae1101123
3 changed files with 16 additions and 2 deletions

View File

@ -27,7 +27,6 @@ function CreateMeshCentralServer(config, args) {
obj.mpsserver = null;
obj.mqttbroker = null;
obj.swarmserver = null;
obj.mailserver = null;
obj.smsserver = null;
obj.amtEventHandler = null;
obj.pluginHandler = null;

View File

@ -36,6 +36,8 @@
"sample-config-advanced.json"
],
"dependencies": {
"archiver": "^4.0.2",
"archiver-zip-encrypted": "^1.0.10",
"body-parser": "^1.19.0",
"cbor": "~5.2.0",
"compression": "^1.7.4",
@ -43,14 +45,25 @@
"express": "^4.17.0",
"express-handlebars": "^3.1.0",
"express-ws": "^4.0.0",
"image-size": "^1.0.0",
"ipcheck": "^0.1.0",
"loadavg-windows": "^1.1.1",
"minimist": "^1.2.0",
"mongodb": "^4.1.0",
"multiparty": "^4.2.1",
"nedb": "^1.8.0",
"node-forge": "^0.10.0",
"node-rdpjs-2": "^0.3.5",
"node-windows": "^1.0.0-beta.5",
"nodemailer": "^6.6.3",
"otplib": "^10.2.3",
"saslprep": "^1.0.3",
"ssh2": "^1.2.0",
"web-push": "^3.4.5",
"ws": "^5.2.3",
"xmldom": "^0.5.0",
"yauzl": "^2.10.0"
"yauzl": "^2.10.0",
"yubikeyotp": "^0.2.0"
},
"repository": {
"type": "git",

View File

@ -4669,6 +4669,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// Get the agent filename
var meshagentFilename = argentInfo.rname;
if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.filename == 'string')) { meshagentFilename = domain.agentcustomization.filename; }
if (req.query.zip == 1) { if (argentInfo.zdata != null) { setContentDispositionHeader(res, 'application/octet-stream', meshagentFilename + '.zip', null, 'meshagent.zip'); res.send(argentInfo.zdata); } else { try { res.sendStatus(404); } catch (ex) { } } return; } // Send compressed agent
setContentDispositionHeader(res, 'application/octet-stream', meshagentFilename, null, 'meshagent');
if (argentInfo.data == null) { res.sendFile(argentInfo.path); } else { res.send(argentInfo.data); }
return;
@ -5037,6 +5038,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0))) {
if ((agentid == 3) || (agentid == 4)) { response += ', <a download href="' + originalUrl + '?id=' + agentinfo.id + '&pdb=1' + (req.query.key ? ('&key=' + req.query.key) : '') + '">PDB</a>'; }
}
if (agentinfo.zdata != null) { response += ', <a download href="' + originalUrl + '?id=' + agentinfo.id + '&zip=1' + (req.query.key ? ('&key=' + req.query.key) : '') + '">ZIP</a>'; }
response += '</td>';
response += '<td>' + agentinfo.size + '</td><td>' + agentinfo.hashhex + '</td>';
response += '<td><a download href="' + originalUrl + '?meshcmd=' + agentinfo.id + (req.query.key ? ('&key=' + req.query.key) : '') + '">' + agentinfo.rname.replace('agent', 'cmd') + '</a></td></tr>';