1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

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

@ -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) + '.');