feature/plugin/web/reboot
This commit is contained in:
parent
e44ebac43f
commit
855bda9104
pwnagotchi/ui/web
@ -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']
|
||||
|
@ -26,6 +26,13 @@ window.onload = function() {
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<form class="action" method="post" action="/reboot"
|
||||
onsubmit="return confirm('this will reboot the unit, continue?');">
|
||||
<input type="submit" class="button ui-btn ui-corner-all" value="Reboot"/>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<form class="action" method="post" action="/restart"
|
||||
onsubmit="return confirm('This will restart the service in {{ other_mode }} mode, continue?');">
|
||||
|
Loading…
x
Reference in New Issue
Block a user