Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Relay's POST /admin actions (save, mod-add, mod-remove, pause, resume, end, take) are handled in src/admin-routes.ts - no behaviour change #169
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
POST /admin handling now lives in src/admin-routes.ts as handleAdmin(lobby, req, res, url, readBody), with no behaviour change. It carries the 16 KiB form limit and all seven actions: save, mod-add, mod-remove, pause, resume, end and take.
shipped merged
A faithful move of the POST /admin handler from relay.ts into admin-routes.ts. The action switch, the 16 KB cap (counted by the bytes read), the 403 for non-editors, the 303 redirect and the AdminError mapping are the same as before. relay.ts keeps readBody and passes it in, so no new dependency and no behaviour change. The preview answers /admin with 401 when anonymous, so the identity gate is intact. The existing admin-relay tests already drive every action through the relay, so they cover the moved code. The page has no mobile or keyboard surface changes.
Two things I would do next:
- Replace the inline 405 JSON in handleAdmin with a shared helper. It duplicates relay.ts json() by hand.
- Add a direct unit test of handleAdmin with a stub readBody, so the module does not depend on the relay to be tested.
POST
/adminhandling now lives insrc/admin-routes.tsashandleAdmin(lobby, req, res, url, readBody), with no behaviour change. It carries the 16 KiB form limit and all seven actions: save, mod-add, mod-remove, pause, resume, end and take.relay.tsno longer has the admin handler, theMAX_FORMconstant or theAdminError/changeFromFormimports. It keeps one call,handleAdmin(..., readBody), and passes its ownreadBodyso the body-reading logic stays in one place.admin-relay.test.ts,relay.test.tsandadmin.test.tspass untouched: 26 pass, 0 fail.bun x tsc --noEmitstill reports one error, insrc/ui/metrics-panel.js(11,64). It appears the same with my change stashed, so it isn't from this change. I left it alone.Closes #122