misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-11-05 14:33:16 +01:00
parent 80e2cdcd8d
commit cf8a4da9e7
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E

@ -1,5 +1,6 @@
import logging import logging
import os import os
import _thread
# https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server # https://stackoverflow.com/questions/14888799/disable-console-messages-in-flask-server
logging.getLogger('werkzeug').setLevel(logging.ERROR) logging.getLogger('werkzeug').setLevel(logging.ERROR)
@ -125,7 +126,7 @@ class Handler:
try: try:
return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), message='Shutting down ...') return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), message='Shutting down ...')
finally: finally:
pwnagotchi.shutdown() _thread.start_new_thread(pwnagotchi.shutdown, ())
# serve a message and restart the unit in the other mode # serve a message and restart the unit in the other mode
def restart(self): def restart(self):
@ -137,7 +138,7 @@ class Handler:
return render_template_string(STATUS_PAGE, title=pwnagotchi.name(), return render_template_string(STATUS_PAGE, title=pwnagotchi.name(),
message='Restart in %s mode ...' % mode) message='Restart in %s mode ...' % mode)
finally: finally:
pwnagotchi.restart(mode) _thread.start_new_thread(pwnagotchi.shutdown, (mode,))
# serve the PNG file with the display image # serve the PNG file with the display image
def ui(self): def ui(self):