Merge pull request #512 from edmael/web_reboot
Added "Reboot into AUTO mode" button in web ui
This commit is contained in:
commit
59019efad0
@ -112,3 +112,14 @@ def reboot():
|
|||||||
logging.warning("rebooting ...")
|
logging.warning("rebooting ...")
|
||||||
os.system("sync")
|
os.system("sync")
|
||||||
os.system("shutdown -r now")
|
os.system("shutdown -r now")
|
||||||
|
|
||||||
|
|
||||||
|
def reboot_into_auto():
|
||||||
|
logging.warning("rebooting into AUTO mode ...")
|
||||||
|
if view.ROOT:
|
||||||
|
view.ROOT.on_reboot()
|
||||||
|
# give it some time to refresh the ui
|
||||||
|
time.sleep(10)
|
||||||
|
os.system("touch /root/.pwnagotchi-auto")
|
||||||
|
os.system("sync")
|
||||||
|
os.system("shutdown -r now")
|
||||||
|
@ -52,8 +52,11 @@ INDEX = """<html>
|
|||||||
<img src="/ui" id="ui" style="width:100%%;image-rendering: pixelated;"/>
|
<img src="/ui" id="ui" style="width:100%%;image-rendering: pixelated;"/>
|
||||||
<br/>
|
<br/>
|
||||||
<hr/>
|
<hr/>
|
||||||
<form method="POST" action="/shutdown" onsubmit="return confirm('This will halt the unit, continue?');">
|
<form style="display:inline;" method="POST" action="/shutdown" onsubmit="return confirm('This will halt the unit, continue?');">
|
||||||
<input type="submit" class="block" value="Shutdown"/>
|
<input style="display:inline;" type="submit" class="block" value="Shutdown"/>
|
||||||
|
</form>
|
||||||
|
<form style="display:inline;" method="POST" action="/reboot_into_auto" onsubmit="return confirm('This will reboot the unit into AUTO mode, continue?');">
|
||||||
|
<input style="display:inline;" type="submit" class="block" value="Reboot into AUTO mode"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -73,6 +76,17 @@ SHUTDOWN = """<html>
|
|||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
|
REBOOT_INTO_AUTO = """<html>
|
||||||
|
<head>
|
||||||
|
<title>%s</title>
|
||||||
|
<style>""" + STYLE + """</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="position: absolute; top:0; left:0; width:100%%;">
|
||||||
|
Rebooting into AUTO mode ...
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>"""
|
||||||
|
|
||||||
class Handler(BaseHTTPRequestHandler):
|
class Handler(BaseHTTPRequestHandler):
|
||||||
AllowedOrigin = None # CORS headers are not sent
|
AllowedOrigin = None # CORS headers are not sent
|
||||||
@ -116,6 +130,11 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
self._html(SHUTDOWN % pwnagotchi.name())
|
self._html(SHUTDOWN % pwnagotchi.name())
|
||||||
pwnagotchi.shutdown()
|
pwnagotchi.shutdown()
|
||||||
|
|
||||||
|
# serve a message and reboot the unit into auto mode
|
||||||
|
def _reboot(self):
|
||||||
|
self._html(REBOOT % pwnagotchi.name())
|
||||||
|
pwnagotchi.reboot_into_auto()
|
||||||
|
|
||||||
# serve the PNG file with the display image
|
# serve the PNG file with the display image
|
||||||
def _image(self):
|
def _image(self):
|
||||||
global frame_lock, frame_path, frame_ctype
|
global frame_lock, frame_path, frame_ctype
|
||||||
|
Loading…
x
Reference in New Issue
Block a user