Added assistantconfig options in config.json.

Ylian Saint-Hilaire committed Jan 31, 2022 at 10:21 UTC 3aaf2f92578bba9ba9b49ed6ce35c396d1fa21e6
3 files changed +15 -13
meshcentral-config-schema.json
+2 -1
@@ -734,7 +734,8 @@
734 "required": [ "id", "secret" ]
735 },
736 "httpHeaders": { "type": "object", "additionalProperties": { "type": "string" } },
737 - "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
737 + "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshAgent .msh file" },
738 + "assistantConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshCentral Assistant .msh file" },
739 "clipboardGet": { "type": "boolean", "default": true, "description": "When false, users can't set the clipboard of a remove device." },
740 "clipboardSet": { "type": "boolean", "default": true, "description": "When false, users can't get the clipboard of a remove device." },
741 "localSessionRecording": { "type": "boolean", "default": true, "description": "When false, removes the local recording feature on remote desktop." },
sample-config-advanced.json
+1
@@ -334,6 +334,7 @@
334 "x-frame-options": "SAMEORIGIN"
335 },
336 "_agentConfig": [ "webSocketMaskOverride=1", "coreDumpEnabled=1" ],
337 + "_assistantConfig": [ "disableUpdate=1" ],
338 "_sessionRecording": {
339 "_onlySelectedUsers": true,
340 "_onlySelectedUserGroups": true,
webserver.js
+12 -12
@@ -4909,21 +4909,18 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
4909 // Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly.
4910 var xdomain = (domain.dns == null) ? domain.id : '';
4911 if (xdomain != '') xdomain += '/';
4912 - var meshsettings = '\r\n';
4913 - if ((req.query.id != '10006') || (req.query.ac != '4')) {
4914 - meshsettings += 'MeshName=' + mesh.name + '\r\nMeshType=' + mesh.mtype + '\r\nMeshID=0x' + meshidhex + '\r\nServerID=' + serveridhex + '\r\n';
4915 - if (obj.args.lanonly != true) { meshsettings += 'MeshServer=wss://' + serverName + ':' + httpsPort + '/' + xdomain + 'agent.ashx\r\n'; } else {
4916 - meshsettings += 'MeshServer=local\r\n';
4917 - if ((obj.args.localdiscovery != null) && (typeof obj.args.localdiscovery.key == 'string') && (obj.args.localdiscovery.key.length > 0)) { meshsettings += 'DiscoveryKey=' + obj.args.localdiscovery.key + '\r\n'; }
4918 - }
4919 - if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; }
4920 - if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; }
4921 - if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; }
4922 - if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } }
4923 - if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + '\r\n'; } }
4912 + var meshsettings = '\r\nMeshName=' + mesh.name + '\r\nMeshType=' + mesh.mtype + '\r\nMeshID=0x' + meshidhex + '\r\nServerID=' + serveridhex + '\r\n';
4913 + if (obj.args.lanonly != true) { meshsettings += 'MeshServer=wss://' + serverName + ':' + httpsPort + '/' + xdomain + 'agent.ashx\r\n'; } else {
4914 + meshsettings += 'MeshServer=local\r\n';
4915 + if ((obj.args.localdiscovery != null) && (typeof obj.args.localdiscovery.key == 'string') && (obj.args.localdiscovery.key.length > 0)) { meshsettings += 'DiscoveryKey=' + obj.args.localdiscovery.key + '\r\n'; }
4916 }
4917 + if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; }
4918 + if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; }
4919 if (req.query.id == '10006') { // Assistant settings and customizations
4920 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
4921 + if (obj.args.assistantconfig) { for (var i in obj.args.assistantconfig) { meshsettings += obj.args.assistantconfig[i] + '\r\n'; } }
4922 + if (domain.assistantconfig) { for (var i in domain.assistantconfig) { meshsettings += domain.assistantconfig[i] + '\r\n'; } }
4923 + if ((domain.assistantnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; }
4924 if ((domain.assistantcustomization != null) && (typeof domain.assistantcustomization == 'object')) {
4925 if (typeof domain.assistantcustomization.title == 'string') { meshsettings += 'Title=' + domain.assistantcustomization.title + '\r\n'; }
4926 if (typeof domain.assistantcustomization.image == 'string') {
@@ -4938,6 +4935,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
4935 }
4936 }
4937 } else { // Add agent customization, not for Assistant
4938 + if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } }
4939 + if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + '\r\n'; } }
4940 + if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; }
4941 if (domain.agentcustomization != null) {
4942 if (domain.agentcustomization.displayname != null) { meshsettings += 'displayName=' + domain.agentcustomization.displayname + '\r\n'; }
4943 if (domain.agentcustomization.description != null) { meshsettings += 'description=' + domain.agentcustomization.description + '\r\n'; }