diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 78189062..5f061635 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -734,7 +734,8 @@ "required": [ "id", "secret" ] }, "httpHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, - "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" } }, + "agentConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshAgent .msh file" }, + "assistantConfig": { "type": "array", "uniqueItems": true, "items": { "type": "string" }, "default": null, "description": "Key and values to add to the MeshCentral Assistant .msh file" }, "clipboardGet": { "type": "boolean", "default": true, "description": "When false, users can't set the clipboard of a remove device." }, "clipboardSet": { "type": "boolean", "default": true, "description": "When false, users can't get the clipboard of a remove device." }, "localSessionRecording": { "type": "boolean", "default": true, "description": "When false, removes the local recording feature on remote desktop." }, diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 3f02ab16..2bc6b293 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -334,6 +334,7 @@ "x-frame-options": "SAMEORIGIN" }, "_agentConfig": [ "webSocketMaskOverride=1", "coreDumpEnabled=1" ], + "_assistantConfig": [ "disableUpdate=1" ], "_sessionRecording": { "_onlySelectedUsers": true, "_onlySelectedUserGroups": true, diff --git a/webserver.js b/webserver.js index 63c7cc58..eb9f1b8b 100644 --- a/webserver.js +++ b/webserver.js @@ -4909,21 +4909,18 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF // Build the agent connection URL. If we are using a sub-domain or one with a DNS, we need to craft the URL correctly. var xdomain = (domain.dns == null) ? domain.id : ''; if (xdomain != '') xdomain += '/'; - var meshsettings = '\r\n'; - if ((req.query.id != '10006') || (req.query.ac != '4')) { - meshsettings += 'MeshName=' + mesh.name + '\r\nMeshType=' + mesh.mtype + '\r\nMeshID=0x' + meshidhex + '\r\nServerID=' + serveridhex + '\r\n'; - if (obj.args.lanonly != true) { meshsettings += 'MeshServer=wss://' + serverName + ':' + httpsPort + '/' + xdomain + 'agent.ashx\r\n'; } else { - meshsettings += 'MeshServer=local\r\n'; - 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'; } - } - if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; } - if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; } - if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; } - if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } } - if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + '\r\n'; } } + var meshsettings = '\r\nMeshName=' + mesh.name + '\r\nMeshType=' + mesh.mtype + '\r\nMeshID=0x' + meshidhex + '\r\nServerID=' + serveridhex + '\r\n'; + if (obj.args.lanonly != true) { meshsettings += 'MeshServer=wss://' + serverName + ':' + httpsPort + '/' + xdomain + 'agent.ashx\r\n'; } else { + meshsettings += 'MeshServer=local\r\n'; + 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'; } } + if ((req.query.tag != null) && (typeof req.query.tag == 'string') && (obj.common.isAlphaNumeric(req.query.tag) == true)) { meshsettings += 'Tag=' + req.query.tag + '\r\n'; } + if ((req.query.installflags != null) && (req.query.installflags != 0) && (parseInt(req.query.installflags) == req.query.installflags)) { meshsettings += 'InstallFlags=' + parseInt(req.query.installflags) + '\r\n'; } if (req.query.id == '10006') { // Assistant settings and customizations 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 + if (obj.args.assistantconfig) { for (var i in obj.args.assistantconfig) { meshsettings += obj.args.assistantconfig[i] + '\r\n'; } } + if (domain.assistantconfig) { for (var i in domain.assistantconfig) { meshsettings += domain.assistantconfig[i] + '\r\n'; } } + if ((domain.assistantnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; } if ((domain.assistantcustomization != null) && (typeof domain.assistantcustomization == 'object')) { if (typeof domain.assistantcustomization.title == 'string') { meshsettings += 'Title=' + domain.assistantcustomization.title + '\r\n'; } if (typeof domain.assistantcustomization.image == 'string') { @@ -4938,6 +4935,9 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF } } } else { // Add agent customization, not for Assistant + if (obj.args.agentconfig) { for (var i in obj.args.agentconfig) { meshsettings += obj.args.agentconfig[i] + '\r\n'; } } + if (domain.agentconfig) { for (var i in domain.agentconfig) { meshsettings += domain.agentconfig[i] + '\r\n'; } } + if ((domain.agentnoproxy === true) || (obj.args.lanonly == true)) { meshsettings += 'ignoreProxyFile=1\r\n'; } if (domain.agentcustomization != null) { if (domain.agentcustomization.displayname != null) { meshsettings += 'displayName=' + domain.agentcustomization.displayname + '\r\n'; } if (domain.agentcustomization.description != null) { meshsettings += 'description=' + domain.agentcustomization.description + '\r\n'; }