diff --git a/server/app.py b/server/app.py index 495c295..1bfaa14 100644 --- a/server/app.py +++ b/server/app.py @@ -282,14 +282,15 @@ def api_searches_post(item: dict = Body(...), request: Request = None): @app.post("/api/events") def api_events(evt: dict = Body(...), request: Request = None): - # client-reported events; only 'error' is accepted (playback failures - # happen in the browser, not in the request log) - if evt.get("type") != "error": + # client-reported events; the diagnostics the browser can uniquely see + # (playback failures, capability probes) happen client-side, not in the + # request log — so the phone reports them here + if evt.get("type") not in ("error", "client-fail", "play-probe"): raise HTTPException(422, "unknown event type") c = db.connect() - db.event(c, request.state.user, "error", - {k: evt[k] for k in ("ep_id", "ep", "lang") if k in evt} - | {"detail": str(evt.get("detail", ""))[:200]}) + db.event(c, request.state.user, evt["type"], + {k: evt[k] for k in ("ep_id", "ep", "lang", "msg", "detail", + "jsv", "branch", "hls_lib", "mse", "native_hls", "ua") if k in evt}) c.commit() c.close() return {"ok": True}