mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-07 12:52:54 -05:00
Update meshuser.js (#6210)
Added a hook "uiCustomEvent" to start plug-ins from custom dialog boxes.
In the config.json:
````
"CustomUI": {
"deviceButtons": {
"custom_dialog": {
"name": "Show custom dialog",
"action": "dialog:customDialog"
}
},
"dialogs": {
"customDialog": {
...
````
In the plug-in: ````
obj.uiCustomEvent = function(command, parent) {
switch(command.element) {
case 'customDialog':
onCustomDialog(command, obj, parent.ws);
break;
default:
console.log("Element "+command.element+ " not supported.");
}
};
````
This commit is contained in:
10
meshuser.js
10
meshuser.js
@@ -4634,6 +4634,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
if (typeof command.logmsg == 'string') { message.msg = command.logmsg; } else { message.nolog = 1; }
|
||||
parent.parent.DispatchEvent(['*', user._id], obj, message);
|
||||
}
|
||||
|
||||
if (parent.parent.pluginHandler != null) // If the plugin's are not supported, reject this command.
|
||||
{
|
||||
command.userid = user._id;
|
||||
try {
|
||||
for( var pluginName in parent.parent.pluginHandler.plugins)
|
||||
if( typeof parent.parent.pluginHandler.plugins[pluginName].uiCustomEvent === 'function' )
|
||||
parent.parent.pluginHandler.plugins[pluginName].uiCustomEvent(command, obj);
|
||||
} catch (ex) { console.log('Error loading plugin handler (' + ex + ')'); }
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'serverBackup': {
|
||||
|
||||
Reference in New Issue
Block a user