mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Made get_configurable_plugins work nicely with config.jsons that include multiple plugin entries as a list (#2161)
* Adds support for config.json to have multiple paths to add to the Plugins dropdown in the Admin Panel * Closes #1370
This commit is contained in:
@@ -54,6 +54,14 @@ def get_configurable_plugins():
|
|||||||
path = os.path.join(plugins_path, dir, "config.json")
|
path = os.path.join(plugins_path, dir, "config.json")
|
||||||
with open(path) as f:
|
with open(path) as f:
|
||||||
plugin_json_data = json.loads(f.read())
|
plugin_json_data = json.loads(f.read())
|
||||||
|
if type(plugin_json_data) is list:
|
||||||
|
for plugin_json in plugin_json_data:
|
||||||
|
p = Plugin(
|
||||||
|
name=plugin_json.get("name"),
|
||||||
|
route=plugin_json.get("route"),
|
||||||
|
)
|
||||||
|
plugins.append(p)
|
||||||
|
else:
|
||||||
p = Plugin(
|
p = Plugin(
|
||||||
name=plugin_json_data.get("name"),
|
name=plugin_json_data.get("name"),
|
||||||
route=plugin_json_data.get("route"),
|
route=plugin_json_data.get("route"),
|
||||||
|
|||||||
Reference in New Issue
Block a user