35cd0657bd
Replace the placeholder browser script with the PLAN.md upload flow. The static UI now creates upload records, slices the selected file into fixed-size chunks, uploads missing chunks with a concurrency pool of three workers, retries failed chunks with exponential backoff, pauses via AbortController, and completes the upload once the server has accepted every chunk. Persist pending upload records in IndexedDB and render them in the page so a reload can resume from server-authoritative progress. When the File System Access API is available, the app stores a file handle and asks for read permission during resume; when it is unavailable or permission is denied, the same pending record resumes after the user reselects the matching file. Browser state is helpful but not trusted: every resume starts by querying the server for completed chunks. Add a JavaScript syntax check to the justfile, update the static-page test and documentation, and extend TESTS.md with the manual resume scenarios that still need real-browser repetition. Test Plan: - just check - UPL_BIND=127.0.0.1:39123 UPL_DATA_DIR=$(mktemp -d) cargo run - curl -fsS http://127.0.0.1:39123/healthz - curl -fsS http://127.0.0.1:39123/ | rg "Choose file|Pending uploads|app.js" - firefox --headless --screenshot /tmp/upl-page.png http://127.0.0.1:39123/ Refs: PLAN.md milestones 5, 6, and 7
53 lines
1.7 KiB
Markdown
53 lines
1.7 KiB
Markdown
# upl
|
|
|
|
`upl` is a small personal resumable upload service. The intended deployment is:
|
|
|
|
```text
|
|
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
|
|
|
|
```text
|
|
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, chunks, and assembly
|
|
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 upload scheduler, retries, and browser resume state
|
|
Validation
|
|
tests/ integration tests for server behavior
|
|
TESTS.md reusable manual and automated test checklist
|
|
```
|
|
|
|
## Configuration
|
|
|
|
- `UPL_BIND` sets the listen address. It defaults to `127.0.0.1:3000`.
|
|
- `UPL_STATIC_DIR` sets the static asset directory. It defaults to `static/`
|
|
inside this repository.
|
|
- `UPL_DATA_DIR` sets the upload data directory. It defaults to `data/` 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:
|
|
|
|
```sh
|
|
just check
|
|
just run
|
|
```
|
|
|
|
`just check` also syntax-checks the static browser JavaScript with `node`.
|