Skip to content

Add in-app experiment file downloads (Downloads menu + ZIP endpoint) - #13

Merged
lamewarden merged 1 commit into
mainfrom
feature/experiment-downloads
Aug 21, 2026
Merged

lamewarden merged 1 commit into
mainfrom
feature/experiment-downloads

Conversation

@lamewarden

Copy link
Copy Markdown
Owner

Adds a Downloads screen so a researcher can pull their own experiment files straight from the web app — no SSH, no Samba, no leaving the browser. Works from any device on the LAN at http://<pi-ip>:8000, same as the kiosk.

  • New GET /api/experiments/{id}/download zips an experiment's whole folder (images, metadata.json, saved config XML) and serves it as an attachment.
  • Built to a temp file on disk, not in memory. A multi-day run can accumulate hundreds of JPEGs; holding the archive in an io.BytesIO() would put the whole thing in RAM at once, which risks real memory pressure on a Pi with as little as 2GB — especially one sitting unattended mid-protocol. Disk under storage_root is comparatively abundant. The temp file is removed by a background task once the response is sent.
  • New Downloads menu in the top nav (modeled on the existing Import menu for consistency) lists the current researcher's experiments with a per-experiment Download ZIP link.
  • The list is filtered client-side by the researcher name already written into each experiment folder. This box has no auth, so that filter is a UI convenience — "my experiments" rather than everyone's — and explicitly not access control. Documented as such in both the code and the README.

Rebased onto main after #12; the only conflict was both branches appending a bullet to the same README feature list. Verified the two features coexist: 158 backend tests pass, npm run typecheck and npm run build clean.

New GET /api/experiments/{id}/download zips an experiment's whole folder
(images, metadata.json, saved config XML) and serves it as an attachment.
Built to a temp file on disk rather than in memory -- a multi-day run can
accumulate hundreds of JPEGs, and holding the whole archive in an
io.BytesIO() risks real memory pressure on a Pi with as little as 2GB RAM.

New Downloads screen (TopNav, modeled on ImportConfigMenu) lists the
current researcher's own experiments -- filtered client-side by the same
getUsername() value already written into each experiment folder name --
with a per-experiment "Download ZIP" link. This box has no auth, so the
filter is a UI convenience (see "my experiments" vs "everyone's"), not
access control; documented as such in the code and README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lamewarden
lamewarden merged commit b4ce62a into main Aug 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant