mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Upgrade plugins from webui/plugins page
This commit is contained in:
@ -188,6 +188,11 @@ class Handler:
|
|||||||
checked = True if 'enabled' in request.form else False
|
checked = True if 'enabled' in request.form else False
|
||||||
return 'success' if plugins.toggle_plugin(request.form['plugin'], checked) else 'failed'
|
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'):
|
if name in plugins.loaded and plugins.loaded[name] is not None and hasattr(plugins.loaded[name], 'on_webhook'):
|
||||||
try:
|
try:
|
||||||
return plugins.loaded[name].on_webhook(subpath, request)
|
return plugins.loaded[name].on_webhook(subpath, request)
|
||||||
|
@ -76,6 +76,11 @@ $(function(){
|
|||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
<input type="hidden" name="plugin" value="{{ name }}"/>
|
<input type="hidden" name="plugin" value="{{ name }}"/>
|
||||||
</form>
|
</form>
|
||||||
|
<form method="POST" action="/plugins/upgrade">
|
||||||
|
<input type="submit" name="upgrade" value="Upgrade">
|
||||||
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
|
<input type="hidden" name="plugin" value="{{ name }}"/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user