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

More base updates, including web socket handling and display logic

This commit is contained in:
Ryan Blenis 2019-10-09 01:22:01 -04:00
parent 39f316b463
commit f60f6963d5
4 changed files with 86 additions and 8 deletions

View file

@ -33,7 +33,7 @@ module.exports.pluginHandler = function (parent) {
obj.plugins[plugin] = require(obj.pluginPath + '/' + plugin + '/' + plugin + '.js')[plugin](obj);
obj.exports[plugin] = obj.plugins[plugin].exports;
} catch (e) {
console.log("Error loading plugin: " + plugin + " (" + e + "). It has been disabled");
console.log("Error loading plugin: " + plugin + " (" + e + "). It has been disabled.", e.stack);
}
}
});
@ -49,7 +49,27 @@ module.exports.pluginHandler = function (parent) {
str += ' obj.'+ p +'.'+ l + ' = '+ obj.plugins[p][l].toString()+'\r\n';
}
}
str += 'return obj; };\r\n';
str += 'obj.enabled = '+ obj.enabled +';\r\n';
str += `obj.onDeviceRefeshEnd = function(nodeid, panel, refresh, event) {
for (const p of Object.keys(obj)) {
if (typeof obj[p].onDeviceRefreshEnd == 'function') {
obj[p].onDeviceRefreshEnd(nodeid, panel, refresh, event);
}
}
};
obj.registerPluginTab = function(pluginRegInfo) {
var d = pluginRegInfo();
QA('p19headers', '<span onclick="return pluginHandler.callPluginPage(\\''+d.tabId+'\\');">'+d.tabTitle+'</span>');
};
obj.callPluginPage = function(id) {
var pages = Q('p19pages').querySelectorAll("#p19pages>div");
for (const i of pages) {
i.style.display = 'none';
}
QV(id, true);
};
return obj; };`;
return str;
}