Merge pull request #703 from ryanblenis/plugin-admin

Plugin Admin Links Broken
This commit is contained in:
Ylian Saint-Hilaire 2019-12-03 21:16:54 -08:00 committed by GitHub
commit 744cb4ae51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -412,12 +412,16 @@ module.exports.pluginHandler = function (parent) {
} else { } else {
parent.db.updatePlugin(id, { status: 1, version: version_only.name }, func); parent.db.updatePlugin(id, { status: 1, version: version_only.name }, func);
} }
obj.plugins[plugin.shortName] = require(obj.pluginPath + '/' + plugin.shortName + '/' + plugin.shortName + '.js')[plugin.shortName](obj); try {
obj.exports[plugin.shortName] = obj.plugins[plugin.shortName].exports; obj.plugins[plugin.shortName] = require(obj.pluginPath + '/' + plugin.shortName + '/' + plugin.shortName + '.js')[plugin.shortName](obj);
if (typeof obj.plugins[plugin.shortName].server_startup == 'function') obj.plugins[plugin.shortName].server_startup(); obj.exports[plugin.shortName] = obj.plugins[plugin.shortName].exports;
var plugin_config = obj.fs.readFileSync(obj.pluginPath + '/' + plugin.shortName + '/config.json'); if (typeof obj.plugins[plugin.shortName].server_startup == 'function') obj.plugins[plugin.shortName].server_startup();
plugin_config = JSON.parse(plugin_config); } catch (e) { console.log('Error instantiating new plugin: ', e); }
parent.db.updatePlugin(plugin._id, plugin_config); try {
var plugin_config = obj.fs.readFileSync(obj.pluginPath + '/' + plugin.shortName + '/config.json');
plugin_config = JSON.parse(plugin_config);
parent.db.updatePlugin(plugin._id, plugin_config);
} catch (e) { console.log('Error reading plugin config upon install'); }
parent.updateMeshCore(); parent.updateMeshCore();
}); });
}); });

View File

@ -9539,7 +9539,7 @@
installedPluginList.forEach(function(p){ installedPluginList.forEach(function(p){
var cant_action = []; var cant_action = [];
if (p.hasAdminPanel == true && p.status) { if (p.hasAdminPanel == true && p.status) {
p.nameHtml = '<a onclick="return goPlugin(' + p.shortName + ', ' + p.name + ');">' + p.name + '</a>'; p.nameHtml = '<a onclick="return goPlugin(\'' + p.shortName + '\', \'' + p.name.replace(/'/g, "\\'") + '\');">' + p.name + '</a>';
} else { } else {
p.nameHtml = p.name; p.nameHtml = p.name;
} }