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:
parent
59a3a22ea5
commit
8b20f44dd5
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': {
|
||||
|
|
Loading…
Reference in New Issue