events: accept client-fail + play-probe types (was 422)

The diagnostic beacons were rejected server-side (only 'error' was
whitelisted) — which is why the iPhone's fingerprint never arrived.
Now: error / client-fail / play-probe accepted, payload fields
forwarded; anything else still 422.
This commit is contained in:
jozamudi committed 2026-08-31 20:22:53 +00:00
1 parent 66a6ed5d93
commit 5268e77d00
1 file changed
+7 -6
+7 -6
View File
@@ -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}