removed unnessesary features
This commit is contained in:
@@ -34,11 +34,22 @@ async def health():
|
||||
|
||||
@app.post("/api/log")
|
||||
async def ingest_event(payload: Event | BatchEvents, game: str = Depends(verify_api_key)):
|
||||
def check_event(e: Event):
|
||||
if not e.type or not e.type.strip():
|
||||
raise HTTPException(400, "Event type is required")
|
||||
if not e.serverId:
|
||||
raise HTTPException(400, "serverId is required")
|
||||
if e.time <= 0:
|
||||
raise HTTPException(400, "Invalid timestamp")
|
||||
# Optionally refuse huge data (e.g., >1KB per event)
|
||||
|
||||
if isinstance(payload, BatchEvents):
|
||||
for event in payload.events:
|
||||
check_event(event)
|
||||
enriched = enrich_event(event, game)
|
||||
write_event(enriched)
|
||||
else:
|
||||
check_event(payload)
|
||||
enriched = enrich_event(payload, game)
|
||||
write_event(enriched)
|
||||
return {"success": True}
|
||||
|
||||
Reference in New Issue
Block a user