docs(api,federation): tus upload endpoints; federation worker boundary note
This commit is contained in:
+14
-2
@@ -184,9 +184,21 @@ PATCH /spaces/:id/join-requests/:rid { action } → { request } [M
|
|||||||
GET /users/@me/join-requests ?status= → { requests[] }
|
GET /users/@me/join-requests ?status= → { requests[] }
|
||||||
```
|
```
|
||||||
|
|
||||||
## Uploads (`routes/uploads.ts`)
|
## Uploads (`routes/files.ts`, `routes/uploads.ts`)
|
||||||
|
|
||||||
|
### Tus Upload Endpoints
|
||||||
|
|
||||||
|
| Method | Path | Auth | Purpose |
|
||||||
|
|--------|------|------|---------|
|
||||||
|
| POST | `/api/files/` | JWT | Create resumable upload. Returns `Location` (upload URL) and `Upload-Expires`. |
|
||||||
|
| HEAD | `/api/files/:uploadId` | JWT (ownership) | Probe `Upload-Offset` for resume. |
|
||||||
|
| PATCH | `/api/files/:uploadId` | JWT (ownership) | Append bytes at offset. |
|
||||||
|
| DELETE | `/api/files/:uploadId` | JWT (ownership) | Abort. |
|
||||||
|
|
||||||
|
The final PATCH that completes an upload returns the `Attachment` JSON in its response body. See `docs/systems/uploads.md` for the full pipeline (PRE_CREATE / PRE_PATCH / POST_FINISH hooks, storage layout, janitor).
|
||||||
|
|
||||||
|
### File Serving
|
||||||
```
|
```
|
||||||
POST /uploads (auth, multipart, rate-limited) → { attachment }
|
|
||||||
GET /uploads/:filename (public, supports Range) → file stream
|
GET /uploads/:filename (public, supports Range) → file stream
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -898,6 +898,10 @@ When the origin instance receives a `file_rejected` event:
|
|||||||
|
|
||||||
Uses the same backoff schedule as outbox delivery. Max attempts: 10 (`MAX_FILE_ATTEMPTS`). After exceeding max attempts: `status = 'failed'`, `rejectionReason = 'max_attempts_exceeded'`.
|
Uses the same backoff schedule as outbox delivery. Max attempts: 10 (`MAX_FILE_ATTEMPTS`). After exceeding max attempts: `status = 'failed'`, `rejectionReason = 'max_attempts_exceeded'`.
|
||||||
|
|
||||||
|
### Boundary vs. tus Upload Migration (2026-04)
|
||||||
|
|
||||||
|
The `federation_file_queue` worker downloads files from peer instances via plain `fetch` + `Readable.fromWeb` to disk, post-completion. It consumes finished files at `${uploadDir}/${filename}`. Whether a file got there via the legacy multipart endpoint, the current tus endpoint at `/api/files/*`, or any future protocol is invisible to this worker -- its contract is purely with the on-disk filename. No changes were required when the upload protocol changed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 8. Read State Relay
|
## 8. Read State Relay
|
||||||
|
|||||||
Reference in New Issue
Block a user