mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Ensure plugins api provides a filtered view
This commit is contained in:
@@ -66,7 +66,7 @@ function getPluginConfigs(lang) {
|
||||
for (var module in moduleConfigs) {
|
||||
/* istanbul ignore else */
|
||||
if (moduleConfigs.hasOwnProperty(module)) {
|
||||
result += get_config_of_plugins(moduleConfigs[module].plugins);
|
||||
result += generateModulePluginConfig(moduleConfigs[module]);
|
||||
}
|
||||
}
|
||||
pluginConfigCache[lang] = result;
|
||||
@@ -78,14 +78,14 @@ function getPluginConfig(id, lang) {
|
||||
let result = '';
|
||||
let moduleConfigs = registry.getModuleList();
|
||||
if (moduleConfigs.hasOwnProperty(id)) {
|
||||
result = get_config_of_plugins(moduleConfigs[id].plugins);
|
||||
result = generateModulePluginConfig(moduleConfigs[id]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// helper function to avoid code duplication
|
||||
function get_config_of_plugins(plugins) {
|
||||
function generateModulePluginConfig(module) {
|
||||
let result = '';
|
||||
const plugins = module.plugins
|
||||
for (let plugin in plugins) {
|
||||
if (plugins.hasOwnProperty(plugin)) {
|
||||
let config = plugins[plugin];
|
||||
|
@@ -65,7 +65,12 @@ function filterNodeInfo(n) {
|
||||
r.err = n.err;
|
||||
}
|
||||
if (n.hasOwnProperty("plugins")) {
|
||||
r.plugins = n.plugins;
|
||||
r.plugins = n.plugins.map(p => {
|
||||
return {
|
||||
id: p.id,
|
||||
type: p.type
|
||||
}
|
||||
});
|
||||
}
|
||||
if (n.type === "plugin") {
|
||||
r.editor = !!n.template;
|
||||
|
Reference in New Issue
Block a user