mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-26 23:48:52 -07:00
619b4c772c
* [playersettings] drop Growth.YIR telemetry on write The client posts its Year-In-Review counters (Growth.YIR.UGC.TubeDistance, Growth.YIR.DistanceTraveled, …) through PUT /playersettings with a new value every time, so the change-detection dedupe never skips them. A two-minute tail at ~500 CCU showed them as about half of all KV writes (3.7 writes/s overall, 448 writes from 448 PUTs). Nothing server-side reads them and the client has none for a new player, so a PUT naming one is answered 200 and nothing is stored. Keys stay unseeded for a player whose only posts are telemetry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * [playersettings] also drop MakerPenSessionCount A per-session counter the client bumps on every post, like the Growth.YIR telemetry; nothing reads it. The maker pen PREFERENCES (MakerPen_SnappingMode and the other MakerPen_* keys) are kept — the client reads those back. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
playersettings
Player-settings worker served on the playersettings subdomain.
GET /— service status{ "service": "playersettings", "status": "ok" }.GET /playersettings—[Authorize]. The player's settings as{ PlayerId, Key, Value }, read from the per-player KV map. On a player's first read it seeds (and persists) the default settings.PUT /playersettings—[Authorize]. Accepts a form-urlencodedkey=…&value=…(or a JSON{key,value}/ array) and upserts it into the player's settings, keyed by thesubclaim of the Bearer JWT. Returns200. Persisted in Workers KV (RECFLARE_PLAYER_SETTINGS, keyplayer:<id>).DELETE /playersettings—[Authorize]. Removes a setting from the player's map. The client sends a bare form-urlencodedkey=PlayerShoppingBagId(novalue); a JSON body and a?key=query param are also read. Deleting a key that isn't stored is a no-op200, not a404.
A full settings PUT would replace the player's entire settings set on each call; we merge instead, so a single-key PUT (e.g.
key=PlayerSessionCount) doesn't wipe the others.
Emptying the map with DELETE puts the player back to a first read: the next
GETre-seeds the defaults.
Keys under
Growth.YIR.(the client's Year-In-Review telemetry — distance drawn, time with friends, …) andMakerPenSessionCountare dropped onPUT, not stored. The client posts them with a new value every time, so they were over half of all writes and nothing reads them. Real maker pen preferences (MakerPen_SnappingMode, …) are kept. SeeIGNORED_SETTING_KEYS/IGNORED_SETTING_PREFIXESindefault-settings.ts.
KV namespace
wrangler kv namespace create RECFLARE_PLAYER_SETTINGS # then put the id in .env under RECFLARE_KV (see .env.example)
Development
Run in dev mode
pnpm dev
Run tests
pnpm test
Deploy
pnpm turbo deploy