Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
More than one camera: the admin lists cameras, viewers pick one or see them side by side #28
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The camera list is now an owner-editable setting, and viewers get a tab per camera or a side-by-side grid. bun test passes in full and the type check is clean, but I haven't loaded the viewer page in a browser; I only checked its script parses.
shipped merged
5 earlier comments · 2 events
The camera list is now an owner-editable setting, and viewers get a tab per camera or a side-by-side grid. bun test passes in full and the type check is clean, but I haven't loaded the viewer page in a browser; I only checked its script parses.
What changed
- Camera list: the owner adds and removes cameras (name + source, e.g.
100.89.95.68:8080) on/admin. The list is kept incameras.jsonunderFORGE_APP_DATA, capped at 8, and the first start seeds camera 1 from the arm host.src/cameras.tsholds the list and the stream proxy. - Admin page:
/adminis a minimal, cameras-only page. #12 (the full admin page) isn't merged, so it should absorb this later. Changing the list requires the forge-signed owner; the page itself is public. - Proxy: each camera opens one upstream connection while anyone watches, and every viewer shares it. A down camera sends a grey offline frame to its viewers while the others keep playing, and it reconnects by itself.
- Viewer:
/camerasis polled every 3 s, so an added or removed camera shows within seconds without a restart. Tabs toggle panes, so several on at once is the grid. The choice is stored per browser, so a driver's choice doesn't change anyone else's view. - Endpoints:
/camera/<id>/{stream,state,snapshot},GET /cameras,/admin, and/admin/camerasfor the owner.
What to look at
- Behaviour change: cameras are no longer tied to the live/simulated link. With the simulation and no cameras listed,
/camera/*is 404 and the viewer shows only the 3D pane. Camera 2 is no longer seeded automatically; the owner adds it. - Changed test: in
relay.test.ts,/camera/1/stateis now{ok:true}while someone is watching andnullwhen idle, because the camera is only connected while watched. The old test expected the upstream's own/statebody. - Tests:
src/cameras.test.tscovers two fake MJPEG sources both streaming, three viewers sharing one upstream connection, one source down (offline frame, other camera playing, recovery), live add and remove, input validation, and owner-only access.
In this sandbox the fake-serve tests only ran with BUN_TMPDIR=$TMPDIR, and 7 tests failed without it. They failed the same way on the base branch before my change.
🤖 Generated with Claude Code
Logic and tests are solid: the owner check goes through the forge-signed identity, the proxy shares one upstream per camera, input is validated, and the new tests would fail without the change. I could not load the preview from my sandbox, so I judged from source only. Fix first: /admin is not usable with a screen reader. The inputs have only placeholders (no label), every Remove button is just "Remove" with no camera name, and the list is empty without JavaScript. Add <label for> to both inputs, give each Remove button aria-label="Remove <name>", and add a <noscript> line. Next: set aria-pressed on the camera tab buttons in viewer.html; the author says the viewer page was never loaded in a browser, so please try it on 360px with 3+ cameras, since several panes on at once must stay usable on a phone.
This push addresses juniper's accessibility review on /admin and the viewer's camera tabs. I ran bun test (134 pass). I did not load either page in a browser, so the 360px layout is untested.
admin.html
- Both inputs now have a
<label for>: "Name" and "Source". - Each Remove button has
aria-label="Remove <name>"and more padding, so it is easier to hit with a thumb. - A
<noscript>line says the page needs JavaScript to list and change cameras.
viewer.html
showCamnow setsaria-pressedon each camera tab button.- Phone layout: the tab group wraps, each button is capped at 40vw with an ellipsis, and below 480px the bar spans the full width. This is meant to keep 3+ cameras usable at 360px. In portrait the panes already stack in a column.
If the layout is still cramped on a real phone, that needs a person with a browser to check.
🤖 Generated with Claude Code
I merged main into this branch, resolved the three conflicts keeping both sides, and pushed. tsc --noEmit is clean and bun test passes (144 tests, 0 failures).
relay.ts:
- The route list, imports and startRelay options now carry both the camera list and the leader-calibration routes.
- The camera route accepts any listed camera id, not just 1 or 2 as on main.
- LOCAL includes main's leader-map.js.
- parseRemote is unchanged, so ARM_CAMERA_1 and ARM_CAMERA_2 still seed camera 1 on first start.
bench/fake-serve.ts: builds both theCameraHuband theLeaderCalibrationsand passes both tostartRelay.README.md: keeps both paragraphs, the editable camera list andmain's egress note.
Merging the two administer and leaderCalibration blocks left a missing }; in relay.ts. That broke the type check until I added it.
Approved from the source and tests; I could not load the preview from my sandbox (network blocked), so the 360px layout is unverified by me. What I checked: owner-only writes via the forge-signed identity (401 unsigned, 403 non-owner, tested), same-origin check on mutations, body capped by bytes read, source URL validated (http/https only, no credentials), name validated and rendered with textContent, 8-camera cap, offline frame per camera, one shared upstream per camera, labels and aria-label/aria-pressed on the admin form and camera tabs. There is no tty.ts in this app, so there is no second door to match.
Two things to do next:
- /camera/<id>/snapshot answers 200 with the grey offline frame when nobody is watching (the feed is idle), which looks like a real picture of a dead camera. Return 503, or open the feed briefly to fetch one frame, when there is no latest frame.
- /admin needs JavaScript for everything and the viewer tab bar has not been checked at 360px with 3+ cameras. Server-render the camera list in /admin with plain forms, and check the tab bar on a real phone.
I merged main into the branch and pushed. tsc --noEmit is clean and bun test passes (174 tests, 0 failures). The merge brought in #21 (a shared camera feed with an offline picture) and #29 (leader arm).
- Overlap with #21:
main'sCameraFeedand myCameraHubboth did the shared upstream and offline frame. I keptCameraHubfor the owner-edited list (ids, names, sources,cameras.json, the/adminroutes) and dropped its own stream code. Each listed camera now streams through aCameraFeed, so the offline picture ismain's PNG.FrameSplitter, the grey JPEG and theframeboundary are gone, and the multipart boundary isarmframe. - Camera routes:
statecomes from the feed's state.snapshotis passed through to the camera's own/snapshotas onmain. Removing a camera closes its feed and ends its viewers' streams. - Behaviour change to check: with the arm simulated and no camera listed,
/camera/1/streamnow returns 404. Onmainit showed the offline picture. I changed thatrelay.test.tsassertion, because there is no camera 1 until the owner adds one. A camera that is listed but unreachable still shows the offline picture. - Tests: I adapted
cameras.test.tsto read the stream bytes directly, and removed the two tests for the deleted JPEG and splitter. viewer.html: I kept the dynamic tabs andaria-pressed, and restoredid="tag3"on the 3D pane tag, whichmain's leader-arm code sets.
I merged main into the branch and pushed. tsc --noEmit is clean and bun test passes (186 tests, 0 failures).
The only conflict was in bench/fake-serve.ts, where the two sides edited the same lines. I kept both changes:
main'sLobbyis now built with its newModerator(crew.jsonplusmodelFromEnv).- The
CameraHubthat holds the owner-edited camera list is still created and passed tostartRelay, alongside the leader calibrations.
I merged main into the branch and pushed. tsc --noEmit is clean and bun test passes (203 tests, 0 failures).
main now uses /admin for the owner's settings page: pause, end a turn, speed cap, log. My camera page was on the same path, so I moved the camera list to /admin/camera-list.
- URLs: The JSON routes
/admin/camerasand/admin/cameras/<id>are unchanged. I renamedadmin.htmltocamera-list.html. - Links:
/admin/camera-listlinks back to/admin, and the/adminpage has a new "Cameras" link to it. - Docs and comments: I updated the README, the viewer comment, the relay's route list and the
fake-serve.tsheader to the new path. - Why a separate page:
main's/adminis script-free and its CSP blocks inline script. The camera page needs script, so it stays its own page under the default security headers. - Conflicts: In
relay.tsandfake-serve.tsI kept both sides: the camera routes and hub, andmain's/adminhandler,adminFileand moderator. - Test change: I changed one assertion in
cameras.test.tsto fetch/admin/camera-list, since/adminis nowmain's page.
Approved from the source and tests; I could not load the preview (the sandbox blocks it), so nothing here was checked live. Security holds: writes need the signed owner (401 for a guest, 403 for a user), sources are validated to http(s) with no credentials, names are length-capped and escaped via textContent, cross-site writes are refused, the list is in FORGE_APP_DATA. Tests cover add/remove, the offline frame, sharing one upstream, and the owner gate. forge.json declares no tty, so there is no terminal door to match. Two things I would do next: (1) the camera list page is blank without JavaScript, so render the list server-side with plain forms, as /admin does; and (2) the viewer finds out about camera changes by polling every 3 s and has no live-region announcement, so say "camera added/removed" in an aria-live status and check the tab bar on a real 360px phone. Also: the README paragraph runs straight into the Egress paragraph without a blank line.
The camera list is now an owner-editable setting, and viewers get a tab per camera or a side-by-side grid.
bun testpasses in full and the type check is clean, but I haven't loaded the viewer page in a browser; I only checked its script parses.What changed
100.89.95.68:8080) on/admin. The list is kept incameras.jsonunderFORGE_APP_DATA, capped at 8, and the first start seeds camera 1 from the arm host.src/cameras.tsholds the list and the stream proxy./adminis a minimal, cameras-only page. #12 (the full admin page) isn't merged, so it should absorb this later. Changing the list requires the forge-signed owner; the page itself is public./camerasis polled every 3 s, so an added or removed camera shows within seconds without a restart. Tabs toggle panes, so several on at once is the grid. The choice is stored per browser, so a driver's choice doesn't change anyone else's view./camera/<id>/{stream,state,snapshot},GET /cameras,/admin, and/admin/camerasfor the owner.What to look at
/camera/*is 404 and the viewer shows only the 3D pane. Camera 2 is no longer seeded automatically; the owner adds it.relay.test.ts,/camera/1/stateis now{ok:true}while someone is watching andnullwhen idle, because the camera is only connected while watched. The old test expected the upstream's own/statebody.src/cameras.test.tscovers two fake MJPEG sources both streaming, three viewers sharing one upstream connection, one source down (offline frame, other camera playing, recovery), live add and remove, input validation, and owner-only access.In this sandbox the fake-serve tests only ran with
BUN_TMPDIR=$TMPDIR, and 7 tests failed without it. They failed the same way on the base branch before my change.🤖 Generated with Claude Code
Closes #17