feat(registry): player profiles, results, ELO ladders and records boards #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/leaderboards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Splits main.go by concern and adds:
gamefield on servers, with?game=on the list; a heartbeat can updategame_rules/server_nameso a host keeps its join code across game swaps; an emptyaddresstakes the caller IPPUT/GET /api/v1/players/{id},POST /api/v1/results,GET /api/v1/leaderboards/{ladder},GET /api/v1/records/{game}/{metric}Also fixes timestamps that always read 0001-01-01, the rate limiter keying on ip:port, and trusting X-Forwarded-For unconditionally (now TRUST_PROXY=1).
Tested:
go test -race ./...18 tests in golang:1.22-alpine;docker build registry/and a smoke of the image. Existing routes and fields unchanged for DodginBalls.https://claude.ai/code/session_013RaBMfSwZjGaigg6JwHv7w
Split main.go into config, db, middleware, ratelimit, servers, players, results/elo and boards files. Existing server routes keep their paths and JSON field names. - Two token tiers: SERVER_TOKEN (verified) and optional HOST_TOKEN (results stored unverified, never move ratings). The body's verified field is ignored. - game column on game_servers (additive migration), ?game= filter on the list. - Heartbeat may update server_name, game and game_rules; "" means leave it. - Register without address uses the caller's IP (X-Forwarded-For only with TRUST_PROXY=1, which now also keys the rate limiter). - PUT/GET /api/v1/players/{id}, POST /api/v1/results (match or record), GET /api/v1/leaderboards/{ladder}, GET /api/v1/records/{game}/{metric}. - Fixes: created_at/last_heartbeat were always 0001-01-01 (DATETIME scanned into a string); rate limiter lost fractional refills; crypto/rand ids. Claude-Session: https://claude.ai/code/session_013RaBMfSwZjGaigg6JwHv7w