diff options
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/handlers_file.go | 1 | ||||
| -rw-r--r-- | internal/api/handlers_media.go | 8 | ||||
| -rw-r--r-- | internal/api/handlers_share.go | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/internal/api/handlers_file.go b/internal/api/handlers_file.go index 7e04de7..d8bb14f 100644 --- a/internal/api/handlers_file.go +++ b/internal/api/handlers_file.go @@ -80,6 +80,7 @@ func (s *Server) handleThumbnail(w http.ResponseWriter, r *http.Request) { if !requireService(w, s.mediaSvc) { return } + w.Header().Set("Cache-Control", "no-cache") s.fileHandler(s.mediaSvc.GetThumbnail)(w, r) } diff --git a/internal/api/handlers_media.go b/internal/api/handlers_media.go index 3863ab0..afb9685 100644 --- a/internal/api/handlers_media.go +++ b/internal/api/handlers_media.go @@ -53,6 +53,7 @@ func (s *Server) handleGetSetCover(w http.ResponseWriter, r *http.Request) { writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) return } + w.Header().Set("Cache-Control", "no-cache") http.ServeFile(w, r, fr.Path) } @@ -231,16 +232,19 @@ func (s *Server) handleListMedia(w http.ResponseWriter, r *http.Request) { setIDs := q.Get("set_ids") search := q.Get("search") typ := q.Get("type") + fav := q.Get("favorites") + minDur := q.Get("min_duration") + maxDur := q.Get("max_duration") start := time.Now() filter := parseMediaListQuery(q) media, err := s.mediaSvc.ListMedia(r.Context(), userIDFromContext(r), filter) dur := time.Since(start) if err != nil { - fmt.Printf("[api] %s set_id=%s set_ids=%s search=%q type=%s error=%v (took %s)\n", path, setID, setIDs, search, typ, err, dur) + fmt.Printf("[api] %s set_id=%s set_ids=%s search=%q type=%s fav=%s min=%s max=%s error=%v (took %s)\n", path, setID, setIDs, search, typ, fav, minDur, maxDur, err, dur) writeJSON(w, http.StatusInternalServerError, map[string]string{"error": err.Error()}) return } - fmt.Printf("[api] %s set_id=%s set_ids=%s search=%q type=%s returned=%d (took %s)\n", path, setID, setIDs, search, typ, len(media), dur) + fmt.Printf("[api] %s set_id=%s set_ids=%s search=%q type=%s fav=%s min=%s max=%s returned=%d (took %s)\n", path, setID, setIDs, search, typ, fav, minDur, maxDur, len(media), dur) writeJSON(w, http.StatusOK, media) } diff --git a/internal/api/handlers_share.go b/internal/api/handlers_share.go index 71b5934..1d8d242 100644 --- a/internal/api/handlers_share.go +++ b/internal/api/handlers_share.go @@ -136,6 +136,7 @@ func (s *Server) handleShareThumbnail(w http.ResponseWriter, r *http.Request) { http.Error(w, "not found", http.StatusNotFound) return } + w.Header().Set("Cache-Control", "no-cache") s.serveFileResult(w, r, fr, false) } |
