fix: Show reboot request response in UI
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 4m40s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Run pytests / Check-Pytest (push) Successful in 11s
All checks were successful
Build RPi Pico firmware image / Build-Firmware (push) Successful in 4m40s
Check code formatting / Check-C-Format (push) Successful in 7s
Check code formatting / Check-Python-Flake8 (push) Successful in 9s
Check code formatting / Check-Bash-Shellcheck (push) Successful in 4s
Run unit tests on host / Run-Unit-Tests (push) Successful in 8s
Run pytests / Check-Pytest (push) Successful in 11s
Also make response from api more understandable for non-technical users. Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
This commit is contained in:
@@ -154,7 +154,7 @@
|
||||
<!-- More screens can be added later -->
|
||||
</ul>
|
||||
<hr>
|
||||
<button onclick="fetch('/api/v1/reboot/bootloader', {'method': 'POST'});">Reboot to bootloader</button>
|
||||
<button onclick="requestReboot()">Reboot to bootloader</button>
|
||||
</div>
|
||||
|
||||
<!-- CONFIG EDITOR SCREEN -->
|
||||
@@ -967,6 +967,14 @@
|
||||
return { init, onShow };
|
||||
})();
|
||||
|
||||
// Misc
|
||||
async function requestReboot() {
|
||||
const resp = await fetch('/api/v1/reboot/bootloader', {'method': 'POST'});
|
||||
if (!resp.ok) {
|
||||
alert('Reboot to bootloader failed: ' + await resp.text());
|
||||
}
|
||||
}
|
||||
|
||||
// Initialization
|
||||
Object.values(Screens).forEach(screen => {
|
||||
screen.init?.();
|
||||
|
||||
@@ -259,7 +259,7 @@ async def audiofile_delete(request):
|
||||
@webapp.route('/api/v1/reboot/<method>', methods=['POST'])
|
||||
async def reboot(request, method):
|
||||
if hwconfig.get_on_battery():
|
||||
return 'not allowed: no vbus', 403
|
||||
return 'not allowed: usb not connected', 403
|
||||
|
||||
if method == 'bootloader':
|
||||
leds.set_state(LedManager.REBOOTING)
|
||||
|
||||
Reference in New Issue
Block a user