From 50d56b86974f7a9dce84e706cd35741b2c691d91 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 4 Feb 2022 14:02:21 -0800 Subject: [PATCH] Added agent customization install text, supported by upcoming agent. --- meshcentral-config-schema.json | 1 + meshcentral.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/meshcentral-config-schema.json b/meshcentral-config-schema.json index 40cda4f7..6271ee3b 100644 --- a/meshcentral-config-schema.json +++ b/meshcentral-config-schema.json @@ -512,6 +512,7 @@ "description": { "type": "string", "default": "Mesh Agent background service", "description": "The description of the agent as displayed to the user." }, "companyName": { "type": "string", "default": "Mesh Agent", "description": "This will be used as the path to install the agent, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's." }, "serviceName": { "type": "string", "default": "Mesh Agent", "description": "The name of the background service, by default this is 'Mesh Agent' in Windows and 'meshagent' in other OS's but should be set to an all lower case, no space string." }, + "installText": { "type": "string", "default": null, "description": "Text string to show in the agent installation dialog box." }, "image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in the MeshCentral Agent installation dialog, image should be square and from 64x64 to 200x200." }, "fileName": { "type": "string", "default": "meshagent", "description": "The agent filename." } } diff --git a/meshcentral.js b/meshcentral.js index a6ca2a42..1fee54fe 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -1560,6 +1560,17 @@ function CreateMeshCentralServer(config, args) { if (translations['zh-chs']) { translations['zh-hans'] = translations['zh-chs']; delete translations['zh-chs']; } if (translations['zh-cht']) { translations['zh-hant'] = translations['zh-cht']; delete translations['zh-cht']; } obj.agentTranslations = JSON.stringify(translations); + + // If there is domain customizations to the agent strings, do this here. + for (var i in obj.config.domains) { + var domainTranslations = translations; + if ((typeof obj.config.domains[i].agentcustomization == 'object') && (typeof obj.config.domains[i].agentcustomization.installtext == 'string')) { + domainTranslations = Object.assign({}, domainTranslations); // Shallow clone + for (var j in domainTranslations) { delete domainTranslations[j].description; } + domainTranslations.en.description = obj.config.domains[i].agentcustomization.installtext; + } + obj.config.domains[i].agentTranslations = domainTranslations; + } } catch (ex) { } // Load the list of mesh agents and install scripts