Added MeshAgent ZIP links when compressed version is available.

Ylian Saint-Hilaire committed Aug 17, 2021 at 15:32 UTC fae11011235d226ef9e39c89f38370848f8d15f8
3 files changed +16 -2
meshcentral.js
-1
@@ -27,7 +27,6 @@ function CreateMeshCentralServer(config, args) {
27 obj.mpsserver = null;
28 obj.mqttbroker = null;
29 obj.swarmserver = null;
30 - obj.mailserver = null;
30 obj.smsserver = null;
31 obj.amtEventHandler = null;
32 obj.pluginHandler = null;
package.json
+14 -1
@@ -36,6 +36,8 @@
36 "sample-config-advanced.json"
37 ],
38 "dependencies": {
39 + "archiver": "^4.0.2",
40 + "archiver-zip-encrypted": "^1.0.10",
41 "body-parser": "^1.19.0",
42 "cbor": "~5.2.0",
43 "compression": "^1.7.4",
@@ -43,14 +45,25 @@
45 "express": "^4.17.0",
46 "express-handlebars": "^3.1.0",
47 "express-ws": "^4.0.0",
48 + "image-size": "^1.0.0",
49 "ipcheck": "^0.1.0",
50 + "loadavg-windows": "^1.1.1",
51 "minimist": "^1.2.0",
52 + "mongodb": "^4.1.0",
53 "multiparty": "^4.2.1",
54 "nedb": "^1.8.0",
55 "node-forge": "^0.10.0",
56 + "node-rdpjs-2": "^0.3.5",
57 + "node-windows": "^1.0.0-beta.5",
58 + "nodemailer": "^6.6.3",
59 + "otplib": "^10.2.3",
60 + "saslprep": "^1.0.3",
61 + "ssh2": "^1.2.0",
62 + "web-push": "^3.4.5",
63 "ws": "^5.2.3",
64 "xmldom": "^0.5.0",
53 - "yauzl": "^2.10.0"
65 + "yauzl": "^2.10.0",
66 + "yubikeyotp": "^0.2.0"
67 },
68 "repository": {
69 "type": "git",
webserver.js
+2
@@ -4669,6 +4669,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4669 // Get the agent filename
4670 var meshagentFilename = argentInfo.rname;
4671 if ((domain.agentcustomization != null) && (typeof domain.agentcustomization.filename == 'string')) { meshagentFilename = domain.agentcustomization.filename; }
4672 + 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
4673 setContentDispositionHeader(res, 'application/octet-stream', meshagentFilename, null, 'meshagent');
4674 if (argentInfo.data == null) { res.sendFile(argentInfo.path); } else { res.send(argentInfo.data); }
4675 return;
@@ -5037,6 +5038,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
5038 if ((user.siteadmin == 0xFFFFFFFF) || ((Array.isArray(obj.parent.config.settings.agentcoredumpusers)) && (obj.parent.config.settings.agentcoredumpusers.indexOf(user._id) >= 0))) {
5039 if ((agentid == 3) || (agentid == 4)) { response += ', <a download href="' + originalUrl + '?id=' + agentinfo.id + '&pdb=1' + (req.query.key ? ('&key=' + req.query.key) : '') + '">PDB</a>'; }
5040 }
5041 + if (agentinfo.zdata != null) { response += ', <a download href="' + originalUrl + '?id=' + agentinfo.id + '&zip=1' + (req.query.key ? ('&key=' + req.query.key) : '') + '">ZIP</a>'; }
5042 response += '</td>';
5043 response += '<td>' + agentinfo.size + '</td><td>' + agentinfo.hashhex + '</td>';
5044 response += '<td><a download href="' + originalUrl + '?meshcmd=' + agentinfo.id + (req.query.key ? ('&key=' + req.query.key) : '') + '">' + agentinfo.rname.replace('agent', 'cmd') + '</a></td></tr>';