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

Improvements to plugin support.

This commit is contained in:
Ylian Saint-Hilaire 2019-10-10 11:13:25 -07:00
parent 5bc3da5bf6
commit ac5b6a9d73
11 changed files with 15748 additions and 561 deletions

View file

@ -1036,7 +1036,8 @@
var sessionActivity = Date.now();
var updateSessionTimer = null;
var pluginHandlerBuilder = {{{pluginHandler}}};
var pluginHandler = new pluginHandlerBuilder();
var pluginHandler = null;
if (pluginHandlerBuilder != null) { pluginHandler = new pluginHandlerBuilder(); }
// Console Message Display Timers
var p11DeskConsoleMsgTimer = null;
@ -2329,14 +2330,9 @@
break;
}
case 'plugin': {
if (typeof message.plugin == 'string') {
try {
pluginHandler[message.plugin][message.method](server, message);
} catch (e) {
console.log('Error loading plugin handler ('+ e + ')');
}
}
break;
if ((pluginHandler == null) || (typeof message.plugin != 'string')) break;
try { pluginHandler[message.plugin][message.method](server, message); } catch (e) { console.log('Error loading plugin handler ('+ e + ')'); }
break;
}
default:
//console.log('Unknown message.action', message.action);
@ -4390,6 +4386,7 @@
QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8) && fileAccess);
QV('MainDevAmt', (node.intelamt != null) && ((node.intelamt.state == 2) || (node.conn & 2)) && (meshrights & 8) && amtAccess);
QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
QV('MainDevPlugins', pluginHandler != null);
QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0));
QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
@ -4435,7 +4432,8 @@
p12clearConsoleMsg();
p13clearConsoleMsg();
pluginHandler.onDeviceRefeshEnd(nodeid, panel, refresh, event);
// Device refresh plugin handler
if (pluginHandler != null) { pluginHandler.onDeviceRefeshEnd(nodeid, panel, refresh, event); }
}
setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
if (!panel) panel = 10;
@ -9168,16 +9166,14 @@
// If we are going to panel 0 in "full screen mode", hide the left bar.
QV('topbar', x != 0);
if ((x == 0) && (webPageFullScreen)) {
QC('body').add("arg_hide");
}
if ((x == 0) && (webPageFullScreen)) { QC('body').add("arg_hide"); }
QV('MainSubMenuSpan', x >= 10 && x < 20);
QV('UserDummyMenuSpan', (x < 10) && (x != 6) && webPageFullScreen);
QV('MeshSubMenuSpan', x >= 20 && x < 30);
QV('UserSubMenuSpan', x >= 30 && x < 40);
QV('ServerSubMenuSpan', x == 6 || x == 115 || x == 40 || x == 41);
var panels = { 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 20: 'MeshGeneral', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 19: 'Plugins', 115: 'ServerConsole' };
var panels = { 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 19: 'MainDevPlugins', 20: 'MeshGeneral', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 115: 'ServerConsole' };
for (var i in panels) {
QC(panels[i]).remove('style3x');
QC(panels[i]).remove('style3sel');