frontend: route all photo queries through sidecar timeline proxy
- listPhotos → /api/sidecar/timeline (was /photos) - countPhotos → /api/sidecar/timeline (was /photos) - hasPhotosMatching → /api/sidecar/timeline (was /photos) - Sidecar handler forwards X-Count header for countPhotos() - Sidecar adjusts X-Count to reflect post-filtered count
This commit is contained in:
@@ -39,6 +39,10 @@ func handlePhotos(pp *ppClient) gin.HandlerFunc {
|
||||
|
||||
// If the user has no BasePath (admin/empty), return as-is.
|
||||
if basePath == "" {
|
||||
// Forward PhotoPrism's X-Count header for countPhotos().
|
||||
if count := resp.Header.Get("X-Count"); count != "" {
|
||||
c.Header("X-Count", count)
|
||||
}
|
||||
c.JSON(http.StatusOK, photos)
|
||||
return
|
||||
}
|
||||
@@ -62,6 +66,8 @@ func handlePhotos(pp *ppClient) gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// Forward X-Count header adjusted to the filtered count.
|
||||
c.Header("X-Count", itoa(len(filtered)))
|
||||
c.JSON(http.StatusOK, filtered)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user