Refactor LED control UI to Vue3
This commit is contained in:
@@ -13,6 +13,11 @@ STATIC_DIR = WEB_DIR / "static"
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
HTML_HEADERS = {
|
||||
"Cache-Control": "no-store",
|
||||
"Clear-Site-Data": '"cache"',
|
||||
}
|
||||
|
||||
ALLOWED_ACTIONS = {
|
||||
"page.next",
|
||||
"page.prev",
|
||||
@@ -20,12 +25,14 @@ ALLOWED_ACTIONS = {
|
||||
"security.alert",
|
||||
"timeline.pause",
|
||||
"timeline.resume",
|
||||
"motion.mode",
|
||||
"scenario.focus",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/", include_in_schema=False)
|
||||
async def admin_index() -> FileResponse:
|
||||
return FileResponse(STATIC_DIR / "admin" / "index.html")
|
||||
return FileResponse(STATIC_DIR / "admin" / "index.html", headers=HTML_HEADERS)
|
||||
|
||||
|
||||
@router.get("/output/{tile_id}", include_in_schema=False)
|
||||
@@ -34,12 +41,12 @@ async def output_index(tile_id: str) -> FileResponse:
|
||||
tiles.get(tile_id)
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=404, detail=f"Unknown output tile: {tile_id}") from exc
|
||||
return FileResponse(STATIC_DIR / "output" / "index.html")
|
||||
return FileResponse(STATIC_DIR / "output" / "index.html", headers=HTML_HEADERS)
|
||||
|
||||
|
||||
@router.get("/wall-app", include_in_schema=False)
|
||||
async def wall_app() -> FileResponse:
|
||||
return FileResponse(STATIC_DIR / "output" / "index.html")
|
||||
return FileResponse(STATIC_DIR / "output" / "index.html", headers=HTML_HEADERS)
|
||||
|
||||
|
||||
@router.get("/favicon.ico", include_in_schema=False)
|
||||
@@ -106,7 +113,6 @@ async def switch_scene(scene_id: str) -> dict:
|
||||
)
|
||||
sync.register_command(commit, payload)
|
||||
await hub.broadcast(prepare, "admin", "outputs")
|
||||
await hub.broadcast(commit, "admin", "outputs")
|
||||
return payload
|
||||
|
||||
|
||||
@@ -149,4 +155,3 @@ async def sync_status() -> dict:
|
||||
async def telemetry(sample: PerformanceSample) -> dict:
|
||||
sync.telemetry(sample)
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@@ -90,6 +90,19 @@ async def output_ws(websocket: WebSocket, tile_id: str) -> None:
|
||||
node_id = str(raw.get("node_id") or node_id or "")
|
||||
sync.clock_quality(node_id, raw.get("clock_offset_ms"), raw.get("rtt_ms"))
|
||||
record = sync.ack(raw)
|
||||
release_record = None
|
||||
if record and raw.get("status") == "prepared":
|
||||
release_record = sync.release_if_prepared(record.command_id)
|
||||
if release_record:
|
||||
await hub.broadcast(
|
||||
CommandEnvelope(
|
||||
type=CommandType.COMMIT_SCENE,
|
||||
command_id=release_record.command_id,
|
||||
payload=release_record.payload,
|
||||
),
|
||||
"admin",
|
||||
"outputs",
|
||||
)
|
||||
await hub.broadcast(
|
||||
CommandEnvelope(
|
||||
type=CommandType.ACK,
|
||||
|
||||
Reference in New Issue
Block a user