Give uploads one path end to end, and serve /uploads/ from Garage first
Frontend: src/uploads.js is the one way to store or show a file (uploadFile, ACCEPT, kindOf, isUploadUrl, tagFor, mediaSize). Chat, the box editor, canvas drops and the background editor all use it; views/home3/upload.js and the chat store's own axios call are gone. Backend: POST /api/uploads (was /messages/upload) is a thin wrapper over services.Uploads.Save, which owns validation, naming and storage. The three per-extension maps are now one UploadTypes table, and a refused file is an *UploadError whose message is safe to show. nginx now fetches /uploads/ from Garage first and falls back to the volume on a 404 or any 5xx, so the bucket is the source of truth and deleting a file in garage-webui unpublishes it, while a Garage outage still only affects bucket-only files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -38,11 +38,9 @@ type Store struct {
|
||||
// services.CallPython: reading a rowing display photo (handle_rowing.go).
|
||||
PythonURL string
|
||||
|
||||
// Where public uploads are stored: the Garage bucket with a disk
|
||||
// fallback, or the disk alone when S3 is not configured
|
||||
// (services.NewUploadStore). nil means the disk, so a Store built in a
|
||||
// test needs no setup.
|
||||
Files services.FileStore
|
||||
// Stores uploaded files and says where they are served
|
||||
// (services.Uploads.Save). Used by the Upload handler.
|
||||
Uploads *services.Uploads
|
||||
|
||||
// Cached "recently played" tracks, refreshed at most once a minute by the
|
||||
// GraphQL spotifyRecent resolver. A pointer to a slice so that nil can
|
||||
|
||||
Reference in New Issue
Block a user