1594c65d891bfb9bdc1f86481dffbb23aa3aeebb
Add the chunk upload and progress APIs from PLAN.md. PUT
/api/uploads/{id}/chunks/{index} now accepts raw octet-stream bodies, validates
unknown upload ids, out-of-range chunk indexes, and exact chunk lengths, then
writes through a temporary .part.tmp path before renaming the completed chunk
into place. Re-uploading an already-complete chunk is idempotent when the
existing file length matches the expected length.
GET /api/uploads/{id} now reports server-authoritative progress by scanning the
chunk directory and only counting chunk files whose lengths match metadata. The
router also raises Axum's request body limit to 64 MiB so the planned 16 MiB
chunks can reach the handler, matching the nginx deployment guidance.
Document the chunk storage responsibility and extend the reusable test checklist
with the new progress and validation coverage.
Test Plan:
- just check
Refs: PLAN.md milestones 3 and 4
upl
upl is a small personal resumable upload service. The intended deployment is:
browser -> nginx -> upl Rust server -> local filesystem
The first implementation milestone provides the Rust server shell and static
browser UI. Upload metadata, chunk persistence, resume state, and completion
assembly are tracked in PLAN.md and will be added in later coherent slices.
Project Structure
upl
Rust server
src/main.rs binary entrypoint and listener setup
src/app.rs Axum router, shared state, static file service
src/api.rs HTTP handlers and API error responses
src/model.rs JSON request, response, and metadata shapes
src/storage.rs local filesystem layout, metadata, and chunk writes
src/lib.rs library surface used by integration tests
Browser UI
static/index.html upload tool markup
static/styles.css responsive tool styling
static/app.js file-selection behavior
Validation
tests/ integration tests for server behavior
TESTS.md reusable manual and automated test checklist
Configuration
UPL_BINDsets the listen address. It defaults to127.0.0.1:3000.UPL_STATIC_DIRsets the static asset directory. It defaults tostatic/inside this repository.UPL_DATA_DIRsets the upload data directory. It defaults todata/inside this repository.- The server accepts request bodies up to 64 MiB, which leaves room for the
planned 16 MiB upload chunks and matches the nginx example in
PLAN.md.
Common Commands
Use the justfile for routine tasks:
just check
just run
Description
Languages
Rust
58.2%
JavaScript
28.9%
Shell
5.8%
CSS
4.9%
HTML
1.8%
Other
0.4%