From c650188e1be137e82e2fbf539d9693037bc2516f Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 11 Jan 2024 10:55:55 +0100 Subject: [PATCH] Upgrade plugins from webui/plugins page --- pwnagotchi/ui/web/handler.py | 5 +++++ pwnagotchi/ui/web/templates/plugins.html | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pwnagotchi/ui/web/handler.py b/pwnagotchi/ui/web/handler.py index 2f0af11b..6bd0ed14 100644 --- a/pwnagotchi/ui/web/handler.py +++ b/pwnagotchi/ui/web/handler.py @@ -188,6 +188,11 @@ class Handler: checked = True if 'enabled' in request.form else False return 'success' if plugins.toggle_plugin(request.form['plugin'], checked) else 'failed' + if name == 'upgrade' and request.method == 'POST': + logging.info(f"Upgrading plugin: {request.form['plugin']}") + os.system(f"pwnagotchi plugins update && pwnagotchi plugins upgrade {request.form['plugin']}") + return redirect("/plugins") + if name in plugins.loaded and plugins.loaded[name] is not None and hasattr(plugins.loaded[name], 'on_webhook'): try: return plugins.loaded[name].on_webhook(subpath, request) diff --git a/pwnagotchi/ui/web/templates/plugins.html b/pwnagotchi/ui/web/templates/plugins.html index 41970fbd..39bebbdc 100644 --- a/pwnagotchi/ui/web/templates/plugins.html +++ b/pwnagotchi/ui/web/templates/plugins.html @@ -76,6 +76,11 @@ $(function(){ +
+ + + +
{% endfor %}