From b7963843451df28049008376d7db82f2c79a93ef Mon Sep 17 00:00:00 2001
From: Simone Margaritelli <evilsocket@gmail.com>
Date: Tue, 5 Nov 2019 15:04:58 +0100
Subject: [PATCH] new: webui status pages reload /ui after a given interval

---
 pwnagotchi/ui/web/handler.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pwnagotchi/ui/web/handler.py b/pwnagotchi/ui/web/handler.py
index c1b47a8..e3ac110 100644
--- a/pwnagotchi/ui/web/handler.py
+++ b/pwnagotchi/ui/web/handler.py
@@ -75,6 +75,7 @@ INDEX = """<html>
 STATUS_PAGE = """<html>
   <head>
       <title>{{ title }}</title>
+      <meta http-equiv="refresh" content="{{ go_back_after }};URL=/ui">
       <style>""" + STYLE + """</style>
   </head>
   <body>
@@ -124,7 +125,8 @@ class Handler:
     # serve a message and shuts down the unit
     def shutdown(self):
         try:
-            return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), message='Shutting down ...')
+            return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), go_back_after=60,
+                                          message='Shutting down ...')
         finally:
             _thread.start_new_thread(pwnagotchi.shutdown, ())
 
@@ -135,7 +137,7 @@ class Handler:
             mode = 'MANU'
 
         try:
-            return render_template_string(STATUS_PAGE, title=pwnagotchi.name(),
+            return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), go_back_after=30,
                                           message='Restart in %s mode ...' % mode)
         finally:
             _thread.start_new_thread(pwnagotchi.restart, (mode,))