New PUT /api/upload endpoint that lets MixBoard upload audio files directly to the server.
Files land in a designated upload directory, get rescanned immediately (playable right away),
and beets enriches them on a cron schedule.
Changes
server.lisp
upload-file handler: streams request body to disk in 64KB chunks
Atomic write: temp file (.tmp) + rename-file on success, delete-file on error
Byte counting in the read loop enforces 200MB limit (does not trust Content-Length)
sanitize-filename: allowlist chars, truncate to 200, strip leading dots/dashes
parse-media-type: strips Content-Type parameters before matching
Synchronous rescan with *rescan-lock* to avoid racing with background rescanner
Returns {"status": "imported", "tracks_added": N, "albums_updated": N}
New constants: +413+ (file too large), +503+ (upload not configured)
config.lisp.example
Added *upload-dir* setting
Added upload directory to *path-url-mappings*
Deployment checklist
config.lisp: Set *upload-dir* and add to *path-url-mappings*
What
New
PUT /api/uploadendpoint that lets MixBoard upload audio files directly to the server. Files land in a designated upload directory, get rescanned immediately (playable right away), and beets enriches them on a cron schedule.Changes
server.lisp
upload-filehandler: streams request body to disk in 64KB chunks.tmp) +rename-fileon success,delete-fileon errorsanitize-filename: allowlist chars, truncate to 200, strip leading dots/dashesparse-media-type: strips Content-Type parameters before matching*rescan-lock*to avoid racing with background rescanner{"status": "imported", "tracks_added": N, "albums_updated": N}+413+(file too large),+503+(upload not configured)config.lisp.example
*upload-dir*setting*path-url-mappings*Deployment checklist
*upload-dir*and add to*path-url-mappings*client_max_body_size 200m;in server blockmkdir -p /data/upload/mixboard && chown uploader:uploader /data/upload/mixboard*/5 * * * * beet import --move --quiet /data/upload/mixboard/ && curl -sX POST http://localhost:5000/api/rescanProtocol
Accepted formats: audio/mpeg, audio/flac, audio/mp4, audio/x-m4a, audio/wav, audio/aiff, audio/ogg
Testing