Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

The owner sets the table height (tableOffsetMm, -100..100 mm) in a field on /admin, saved through PUT /settings by the page's one hashed script #332

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The owner's /admin now has a "Table height" number field for tableOffsetMm (-100..100, step 1) with a Save button. A moderator gets neither the field nor the code that saves it. The field loads the current value with GET /settings.

Notes

shipped merged

opened this

The owner's /admin now has a "Table height" number field for tableOffsetMm (-100..100, step 1) with a Save button. A moderator gets neither the field nor the code that saves it.

The field loads the current value with GET /settings. Save sends a same-origin PUT /settings and shows the saved value or the server's error text.

  • One script: the page still has exactly one inline script. For the owner it is HEALTH_SCRIPT plus a new TABLE_SCRIPT. For a moderator it is HEALTH_SCRIPT alone.
  • CSP: ADMIN_CSP became adminCsp(canEdit) in src/admin-page.ts, with the one sha256 matching whichever script the caller gets. src/admin-routes.ts is its only user. There is no unsafe-inline and no new CSP sources.
  • Untouched: viewer.html, the page's modules, forge.json, and the CSP and lobby.test.ts edits from #307, so the first-visit gzip budget is unchanged.
  • Tests: the new src/admin-page.test.ts checks that:

- the field is present for the owner and absent for a moderator; - there is one <script tag; - its hash matches the CSP.

  • README: Software/README.md now says where to set the table height.

tsc --noEmit is clean. In the full bun test run, 572 passed and 1 failed. The summary didn't say which test, and I didn't run the whole suite again to find out. cameras.test.ts and admin-page.test.ts pass when run alone, so the failure may be timing-dependent. The forge's check will run the whole suite.

I didn't open the preview.

🤖 Generated with Claude Code

Closes #325

commented

The owner's /admin now has a "Table height" number field for tableOffsetMm (-100..100, step 1) with a Save button. A moderator gets neither the field nor the code that saves it.

The field loads the current value with GET /settings. Save sends a same-origin PUT /settings and shows the saved value or the server's error text.

  • One script: the page still has exactly one inline script. For the owner it is HEALTH_SCRIPT plus a new TABLE_SCRIPT. For a moderator it is HEALTH_SCRIPT alone.
  • CSP: ADMIN_CSP became adminCsp(canEdit) in src/admin-page.ts, with the one sha256 matching whichever script the caller gets. src/admin-routes.ts is its only user. There is no unsafe-inline and no new CSP sources.
  • Untouched: viewer.html, the page's modules, forge.json, and the CSP and lobby.test.ts edits from #307, so the first-visit gzip budget is unchanged.
  • Tests: the new src/admin-page.test.ts checks that:

- the field is present for the owner and absent for a moderator; - there is one <script tag; - its hash matches the CSP.

  • README: Software/README.md now says where to set the table height.

tsc --noEmit is clean. In the full bun test run, 572 passed and 1 failed. The summary didn't say which test, and I didn't run the whole suite again to find out. cameras.test.ts and admin-page.test.ts pass when run alone, so the failure may be timing-dependent. The forge's check will run the whole suite.

I didn't open the preview.

🤖 Generated with Claude Code

Approved

Approved. The owner gets a Table height number field (-100..100, step 1, labelled, with role=status feedback) on /admin. The page keeps exactly one hashed inline script, with no unsafe-inline. A moderator gets neither the field nor the PUT code, and a test proves both the hash match and that gap. The write goes through the existing validated PUT /settings, and the terminal already has /table. The README is updated. I could not see /admin on the preview because non-admins get 404 there by design, so I judged it from source and tests.

Two things I would do next:

  1. Add a test that runs TABLE_SCRIPT against a stubbed fetch, covering the error text and the saved value. Today only the markup and the hash are tested.
  2. Say which test failed in the full run. The pull says 572 passed and 1 failed, and it never names the failure.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs