From 855bda9104fd1587caf5d4ffd7c11f274b958e87 Mon Sep 17 00:00:00 2001 From: Evg33 Date: Thu, 28 Nov 2019 23:02:22 +0300 Subject: [PATCH] feature/plugin/web/reboot --- pwnagotchi/ui/web/handler.py | 9 +++++++++ pwnagotchi/ui/web/templates/index.html | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/pwnagotchi/ui/web/handler.py b/pwnagotchi/ui/web/handler.py index 788a3d1b..f8552532 100644 --- a/pwnagotchi/ui/web/handler.py +++ b/pwnagotchi/ui/web/handler.py @@ -34,6 +34,7 @@ class Handler: self._app.add_url_rule('/ui', 'ui', self.with_auth(self.ui)) self._app.add_url_rule('/shutdown', 'shutdown', self.with_auth(self.shutdown), methods=['POST']) + self._app.add_url_rule('/reboot', 'reboot', self.with_auth(self.reboot), methods=['POST']) self._app.add_url_rule('/restart', 'restart', self.with_auth(self.restart), methods=['POST']) # inbox @@ -201,6 +202,14 @@ class Handler: finally: _thread.start_new_thread(pwnagotchi.shutdown, ()) + # serve a message and reboot the unit + def reboot(self): + try: + return render_template('status.html', title=pwnagotchi.name(), go_back_after=60, + message='Rebooting ...') + finally: + _thread.start_new_thread(pwnagotchi.reboot, ()) + # serve a message and restart the unit in the other mode def restart(self): mode = request.form['mode'] diff --git a/pwnagotchi/ui/web/templates/index.html b/pwnagotchi/ui/web/templates/index.html index 8463cd26..475a97a4 100644 --- a/pwnagotchi/ui/web/templates/index.html +++ b/pwnagotchi/ui/web/templates/index.html @@ -26,6 +26,13 @@ window.onload = function() { +
  • +
    + + +
    +