!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/node-red/packages/node_modules/@node-red/registry/lib/   drwxr-xr-x
Free 13.16 GB of 57.97 GB (22.69%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     plugins.js (5.11 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
const registry = require("./registry");
const {events} = require("@node-red/util");
const clone = require("clone");

let pluginConfigCache = {};
let pluginToId = {};
let plugins = {};
let pluginsByType = {};
let pluginSettings = {};
let settings;

function init(_settings) {
    settings = _settings;
    plugins = {};
    pluginConfigCache = {};
    pluginToId = {};
    pluginsByType = {};
    pluginSettings = {};
}

function registerPlugin(nodeSetId,id,definition) {
    var moduleId = registry.getModuleFromSetId(nodeSetId);
    var pluginId = registry.getNodeFromSetId(nodeSetId);

    definition.id = id;
    definition.module = moduleId;
    pluginToId[id] = nodeSetId;
    plugins[id] = definition;
    var module = registry.getModule(moduleId);

    definition.path = module.path;

    module.plugins[pluginId].plugins.push(definition);
    if (definition.type) {
        pluginsByType[definition.type] = pluginsByType[definition.type] || [];
        pluginsByType[definition.type].push(definition);
    }
    if (definition.settings) {
        pluginSettings[id] = definition.settings;
    }


    if (definition.onadd && typeof definition.onadd === 'function') {
        definition.onadd();
    }
    events.emit("registry:plugin-added",id);
}

function getPlugin(id) {
    return plugins[id]
}

function getPluginsByType(type) {
    return pluginsByType[type] || [];
}

function getPluginConfigs(lang) {
    if (!pluginConfigCache[lang]) {
        var result = "";
        var script = "";
        var moduleConfigs = registry.getModuleList();
        for (var module in moduleConfigs) {
            /* istanbul ignore else */
            if (moduleConfigs.hasOwnProperty(module)) {
                var plugins = moduleConfigs[module].plugins;
                for (var plugin in plugins) {
                    if (plugins.hasOwnProperty(plugin)) {
                        var config = plugins[plugin];
                        if (config.enabled && !config.err && config.config) {
                            result += "\n<!-- --- [red-plugin:"+config.id+"] --- -->\n";
                            result += config.config;
                        }
                    }
                }
            }
        }
        pluginConfigCache[lang] = result;
    }
    return pluginConfigCache[lang];
}
function getPluginList() {
    var list = [];
    var moduleConfigs = registry.getModuleList();
    for (var module in moduleConfigs) {
        /* istanbul ignore else */
        if (moduleConfigs.hasOwnProperty(module)) {
            var plugins = moduleConfigs[module].plugins;
            for (var plugin in plugins) {
                /* istanbul ignore else */
                if (plugins.hasOwnProperty(plugin)) {
                    var pluginInfo = registry.filterNodeInfo(plugins[plugin]);
                    pluginInfo.version = moduleConfigs[module].version;
                    // if (moduleConfigs[module].pending_version) {
                    //     nodeInfo.pending_version = moduleConfigs[module].pending_version;
                    // }
                    list.push(pluginInfo);
                }
            }
        }
    }
    return list;
}

function exportPluginSettings(safeSettings) {
    for (let id in pluginSettings) {
        if (pluginSettings.hasOwnProperty(id)) {
            if (settings.hasOwnProperty(id) && !safeSettings.hasOwnProperty(id)) {
                let pluginTypeSettings = pluginSettings[id];
                let exportedSet = {};
                let defaultExportable = false;
                if (pluginTypeSettings['*'] && pluginTypeSettings['*'].hasOwnProperty("exportable")) {
                    defaultExportable = pluginTypeSettings['*'].exportable;
                }
                if (defaultExportable) {
                    exportedSet = clone(settings[id]);
                }
                for (let property in pluginTypeSettings) {
                    if (pluginTypeSettings.hasOwnProperty(property)) {
                        let setting = pluginTypeSettings[property];
                        if (defaultExportable) {
                            if (setting.exportable === false) {
                                delete exportedSet[property]
                            } else if (!exportedSet.hasOwnProperty(property) && setting.hasOwnProperty('value')) {
                                exportedSet[property] = setting.value;
                            }
                        } else if (setting.exportable) {
                            if (settings[id].hasOwnProperty(property)) {
                                exportedSet[property] = settings[id][property];
                            } else if (setting.hasOwnProperty('value')) {
                                exportedSet[property] = setting.value;
                            }
                        }
                    }
                }
                if (Object.keys(exportedSet).length > 0) {
                    safeSettings[id] = exportedSet;
                }
            }
        }
    }

    return safeSettings;
}

module.exports = {
    init,
    registerPlugin,
    getPlugin,
    getPluginsByType,
    getPluginConfigs,
    getPluginList,
    exportPluginSettings
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.009 ]--