From f98a440200bed8629c64d6a86ba1e6f211c9a054 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 22 Nov 2019 00:00:14 +0100 Subject: [PATCH] Support for explicit enabled_plugins/disabled_plugins on webpanel index --- platypush/backend/http/app/routes/index.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/app/routes/index.py b/platypush/backend/http/app/routes/index.py index db8b440b..65ed0441 100644 --- a/platypush/backend/http/app/routes/index.py +++ b/platypush/backend/http/app/routes/index.py @@ -1,6 +1,6 @@ import os -from flask import Blueprint, render_template +from flask import Blueprint, render_template, request from platypush.backend.http.app import template_folder, static_folder from platypush.backend.http.app.utils import authenticate, get_websocket_port @@ -26,12 +26,22 @@ def index(): enabled_scripts = {} enabled_styles = {} + enabled_plugins = set(request.args.get('enabled_plugins', '').split(',')) + for plugin in enabled_plugins: + if plugin not in configured_plugins: + configured_plugins[plugin] = {} + + disabled_plugins = set(request.args.get('disabled_plugins', '').split(',')) + js_folder = os.path.abspath( os.path.join(template_folder, '..', 'static', 'js')) style_folder = os.path.abspath( os.path.join(template_folder, '..', 'static', 'css', 'dist')) for plugin, conf in configured_plugins.items(): + if plugin in disabled_plugins: + continue + template_file = os.path.join( template_folder, 'plugins', plugin, 'index.html')