diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-07-14 11:37:22 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-07-14 11:37:22 +0530 |
| commit | ed87aebc0296379280fd65d618127b4eeb848a98 (patch) | |
| tree | b407e464735cfabfe49df727149c9569c2ee0bea /internal/api/reload.go | |
| parent | 48fae70cf1a6b99966cd65c0229a936382984bc6 (diff) | |
| download | galleryd-ed87aebc0296379280fd65d618127b4eeb848a98.tar.xz galleryd-ed87aebc0296379280fd65d618127b4eeb848a98.zip | |
feat(api): add manual gallery reload endpoint
Diffstat (limited to 'internal/api/reload.go')
| -rw-r--r-- | internal/api/reload.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/api/reload.go b/internal/api/reload.go new file mode 100644 index 0000000..bd3cffb --- /dev/null +++ b/internal/api/reload.go @@ -0,0 +1,25 @@ +package api + +import ( + "log" + "net/http" +) + +func (s *Server) handleReload( + w http.ResponseWriter, + r *http.Request, +) { + if err := s.gallery.Reload(r.Context()); err != nil { + log.Printf("reload gallery: %v", err) + + writeError( + w, + http.StatusInternalServerError, + "failed to reload gallery", + ) + + return + } + + w.WriteHeader(http.StatusNoContent) +} |