Tweak module loading to match new Rack 2.1.1 behaviour
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
ed0a04a11c
commit
21004ab183
1 changed files with 11 additions and 1 deletions
|
@ -821,13 +821,23 @@ struct StaticPluginLoader {
|
||||||
json_t* const version = json_string((APP_VERSION_MAJOR + ".0").c_str());
|
json_t* const version = json_string((APP_VERSION_MAJOR + ".0").c_str());
|
||||||
json_object_set(rootJ, "version", version);
|
json_object_set(rootJ, "version", version);
|
||||||
json_decref(version);
|
json_decref(version);
|
||||||
|
|
||||||
|
// Load manifest
|
||||||
|
p->fromJson(rootJ);
|
||||||
|
|
||||||
|
// Reject plugin if slug already exists
|
||||||
|
if (Plugin* const existingPlugin = getPlugin(p->slug))
|
||||||
|
throw Exception("Plugin %s is already loaded, not attempting to load it again", p->slug.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
~StaticPluginLoader()
|
~StaticPluginLoader()
|
||||||
{
|
{
|
||||||
if (rootJ != nullptr)
|
if (rootJ != nullptr)
|
||||||
{
|
{
|
||||||
plugin->fromJson(rootJ);
|
// Load modules manifest
|
||||||
|
json_t* const modulesJ = json_object_get(rootJ, "modules");
|
||||||
|
plugin->modulesFromJson(modulesJ);
|
||||||
|
|
||||||
json_decref(rootJ);
|
json_decref(rootJ);
|
||||||
plugins.push_back(plugin);
|
plugins.push_back(plugin);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue