Compare commits
1 Commits
17ccefd922
...
feat/api_e
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a402e90bd |
@@ -153,8 +153,6 @@
|
||||
<li><button onclick="showScreen('playlist')">Open Playlist Editor</button></li>
|
||||
<!-- More screens can be added later -->
|
||||
</ul>
|
||||
<hr>
|
||||
<button onclick="fetch('/api/v1/reboot/bootloader', {'method': 'POST'});">Reboot to bootloader</button>
|
||||
</div>
|
||||
|
||||
<!-- CONFIG EDITOR SCREEN -->
|
||||
|
||||
@@ -196,5 +196,8 @@ class PlayerApp:
|
||||
def get_playlist_db(self):
|
||||
return self.playlist_db
|
||||
|
||||
def get_timer_manager(self):
|
||||
return self.timer_manager
|
||||
|
||||
def get_leds(self):
|
||||
return self.leds
|
||||
|
||||
@@ -4,6 +4,7 @@ Copyright (c) 2024-2025 Stefan Kratochwil <Kratochwil-LA@gmx.de>
|
||||
'''
|
||||
|
||||
import asyncio
|
||||
import hwconfig
|
||||
import json
|
||||
import machine
|
||||
import os
|
||||
@@ -33,7 +34,7 @@ def start_webserver(config_, app_):
|
||||
nfc = app.get_nfc()
|
||||
playlist_db = app.get_playlist_db()
|
||||
leds = app.get_leds()
|
||||
timer_manager = TimerManager()
|
||||
timer_manager = app.get_timer_manager()
|
||||
|
||||
|
||||
@webapp.before_request
|
||||
@@ -257,6 +258,9 @@ 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
|
||||
|
||||
if method == 'bootloader':
|
||||
leds.set_state(LedManager.REBOOTING)
|
||||
timer_manager.schedule(time.ticks_ms() + 1500, machine.bootloader)
|
||||
|
||||
Reference in New Issue
Block a user