mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-18 17:55:24 -04:00
Safety check if plugin actually has exports before attempting to export functions
This commit is contained in:
parent
a0f0f31c86
commit
e754cfbacf
@ -66,10 +66,12 @@ module.exports.pluginHandler = function (parent) {
|
|||||||
|
|
||||||
for (const p of Object.keys(obj.plugins)) {
|
for (const p of Object.keys(obj.plugins)) {
|
||||||
str += ' obj.' + p + ' = {};\r\n';
|
str += ' obj.' + p + ' = {};\r\n';
|
||||||
|
if (Array.isArray(obj.exports[p])) {
|
||||||
for (const l of Object.values(obj.exports[p])) {
|
for (const l of Object.values(obj.exports[p])) {
|
||||||
str += ' obj.' + p + '.' + l + ' = ' + obj.plugins[p][l].toString() + '\r\n';
|
str += ' obj.' + p + '.' + l + ' = ' + obj.plugins[p][l].toString() + '\r\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
str += `
|
str += `
|
||||||
obj.callHook = function(hookName, ...args) {
|
obj.callHook = function(hookName, ...args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user