Added Assistant Customization.

Ylian Saint-Hilaire committed Jun 3, 2021 at 17:35 UTC dc3f21e1dd283ea15af29ab5c4365062222bae4f
5 files changed +12 -4
agents/MeshCentralAssistant.exe
Binary files a/agents/MeshCentralAssistant.exe and b/agents/MeshCentralAssistant.exe differ
package.json
+1 -1
@@ -45,7 +45,7 @@
45 "express-ws": "^4.0.0",
46 "ipcheck": "^0.1.0",
47 "minimist": "^1.2.0",
48 - "multiparty": "^4.2.1",
48 + "multiparty": "^4.2.2",
49 "nedb": "^1.8.0",
50 "node-forge": "^0.10.0",
51 "ws": "^7.4.6",
public/images/user-256.png
Binary files a/public/images/user-256.png and /dev/null differ
views/default.handlebars
+1 -1
@@ -4729,7 +4729,7 @@
4729 x += '<div id=aginsTypeDiv>';
4730 x += addHtmlValue("Installation Type", '<select id=aginsType onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Background & interactive" + '</option><option value=2>' + "Background only" + '</option><option value=1>' + "Interactive only" + '</option></select>');
4731 x += '</div><div id=asinsTypeDiv>';
4732 - x += addHtmlValue("Installation Type", '<select id=asinsType onchange=addAgentToMeshClick() style=width:236px><option value=0>' + "Connect on user request" + '</option><option value=1>' + "Always connected" + '</option></select>');
4732 + x += addHtmlValue("Installation Type", '<select id=asinsType onchange=addAgentToMeshClick() style=width:236px><option value=2>' + "Application, Connect on user request" + '</option><option value=3>' + "Application, Always connected" + '</option><option value=0>' + "System Tray, Connect on user request" + '</option><option value=1>' + "System Tray, Always connected" + '</option></select>');
4733 x += '</div><hr>';
4734
4735 // \/:*?"<>|
webserver.js
+10 -2
@@ -4637,7 +4637,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4637 if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; }
4638 if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } }
4639 if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + '\r\n'; } }
4640 - if (domain.agentcustomization != null) { // Add agent customization
4640 + if ((req.query.id != '10006') && (domain.agentcustomization != null)) { // Add agent customization, not for Assistant
4641 if (domain.agentcustomization.displayname != null) { meshsettings += 'displayName=' + domain.agentcustomization.displayname + '\r\n'; }
4642 if (domain.agentcustomization.description != null) { meshsettings += 'description=' + domain.agentcustomization.description + '\r\n'; }
4643 if (domain.agentcustomization.companyname != null) { meshsettings += 'companyName=' + domain.agentcustomization.companyname + '\r\n'; }
@@ -4645,7 +4645,15 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4645 if (domain.agentcustomization.filename != null) { meshsettings += 'fileName=' + domain.agentcustomization.filename + '\r\n'; }
4646 }
4647 if ((parent.agentTranslations != null) && (req.query.id != '10006')) { meshsettings += 'translation=' + parent.agentTranslations + '\r\n'; } // Translation strings, not for MeshCentral Assistant
4648 - if ((req.query.id == '10006') && (req.query.ac == '1')) { meshsettings += 'AutoConnect=1\r\n'; } // Set AutoConnect=1 for MeshCentral Assistant if requested
4648 + if (req.query.id == '10006') { // Assistant settings and customizations
4649 + if ((req.query.ac != null)) { meshsettings += 'AutoConnect=' + req.query.ac + '\r\n'; } // Set MeshCentral Assistant flags if needed. 0x01 = Always Connected, 0x02 = Not System Tray
4650 + if ((domain.assistantcustomization != null) && (typeof domain.assistantcustomization == 'object')) {
4651 + if (typeof domain.assistantcustomization.title == 'string') { meshsettings += 'Title=' + domain.assistantcustomization.title + '\r\n'; }
4652 + if (typeof domain.assistantcustomization.image == 'string') {
4653 + try { meshsettings += 'Image=' + Buffer.from(obj.fs.readFileSync(parent.getConfigFilePath(domain.assistantcustomization.image)), 'binary').toString('base64') + '\r\n'; } catch (ex) { console.log(ex); }
4654 + }
4655 + }
4656 + }
4657 setContentDispositionHeader(res, 'application/octet-stream', meshfilename, null, argentInfo.rname);
4658 obj.parent.exeHandler.streamExeWithMeshPolicy({ platform: 'win32', sourceFileName: obj.parent.meshAgentBinaries[req.query.id].path, destinationStream: res, msh: meshsettings, peinfo: obj.parent.meshAgentBinaries[req.query.id].pe });
4659 return;