Added Android Customization.

This commit is contained in:
Ylian Saint-Hilaire 2021-06-23 16:59:36 -07:00
parent 89804385bb
commit 778e8bd128
4 changed files with 35 additions and 1 deletions

View File

@ -193,7 +193,7 @@
<Compile Include="public\scripts\amt-wsman-0.2.0.js" />
<Compile Include="public\scripts\amt-wsman-ws-0.2.0.js" />
<Compile Include="public\scripts\common-0.0.1.js" />
<Compile Include="public\scripts\meshcentral.js" />
<cls Include="public\scripts\meshcentral.js" />
<Compile Include="redirserver.js" />
<Compile Include="translate\translate.js" />
<Compile Include="ua-parser.js" />

View File

@ -1621,6 +1621,28 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
}
break;
}
case 'getServerImage': {
if (command.agent === 'assistant') {
// Return server title and image for MeshCentral Assistant
if ((domain.assistantcustomization != null) && (typeof domain.assistantcustomization == 'object')) {
var ok = false;
if (typeof domain.assistantcustomization.title == 'string') { ok = true; command.title = domain.assistantcustomization.title; }
if (typeof domain.assistantcustomization.image == 'string') { try { command.image = 'data:image/jpeg;base64,' + Buffer.from(parent.fs.readFileSync(parent.parent.getConfigFilePath(domain.assistantcustomization.image)), 'binary').toString('base64'); ok = true; } catch (ex) { console.log(ex); } }
if (ok) { obj.send(JSON.stringify(command)); }
}
}
if (command.agent === 'android') {
// Return server title and image for MeshCentral Assistant
if ((domain.androidcustomization != null) && (typeof domain.androidcustomization == 'object')) {
var ok = false;
if (typeof domain.androidcustomization.title == 'string') { ok = true; command.title = domain.androidcustomization.title; }
if (typeof domain.androidcustomization.subtitle == 'string') { ok = true; command.subtitle = domain.androidcustomization.subtitle; }
if (typeof domain.androidcustomization.image == 'string') { try { command.image = 'data:image/jpeg;base64,' + Buffer.from(parent.fs.readFileSync(parent.parent.getConfigFilePath(domain.androidcustomization.image)), 'binary').toString('base64'); ok = true; } catch (ex) { console.log(ex); } }
if (ok) { obj.send(JSON.stringify(command)); }
}
}
break;
}
default: {
parent.agentStats.unknownAgentActionCount++;
parent.parent.debug('agent', 'Unknown agent action (' + obj.remoteaddrport + '): ' + JSON.stringify(command) + '.');

View File

@ -456,6 +456,16 @@
"fileName": { "type": "string", "default": "meshagent", "description": "The MeshCentral Assistant filename." }
}
},
"androidCustomization": {
"type": "object",
"additionalProperties": false,
"description": "Use this section to customize the MeshCentral Agent for Android.",
"properties": {
"title": { "type": "string", "default": "MeshCentral Agent", "description": "Displayed on top of the MeshCentral Agent for Android." },
"subtitle": { "type": "string", "default": null, "description": "Subtitle displayed until the title on the toolbar." },
"image": { "type": "string", "default": null, "description": "The filename of a image file in .png format located in meshcentral-data to display in MeshCentral Agent for Android, image should be square and from 64x64 to 128x128." },
}
},
"userAllowedIP": { "type": "string" },
"userBlockedIP": { "type": "string" },
"agentAllowedIP": { "type": "string" },

View File

@ -14751,6 +14751,8 @@
function seriesColor2(n) { return 'rgba('+seriesColors[n][0]+','+seriesColors[n][1]+','+seriesColors[n][2]+')'; }
function updateServerTimelineStats() {
if (serverTimelineStats == null) return;
var data, chartType = Q('p40type').value, timeAfter = pastDate(Q('p40time').value), servers = [], selectedServer = null, serverEmptyExists = false, serverAutoSelect = true;
if (Q('p40server').value != null) { selectedServer = decodeURIComponent(Q('p40server').value); if (selectedServer == "") { selectedServer = null; } serverAutoSelect = false; }
serverTimelineConfig.options.scales.xAxes[0].time = { min: timeAfter };