diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-07-13 17:49:32 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-07-13 17:49:32 +0530 |
| commit | d87995c3629cac4671b05073915214f45d0c7112 (patch) | |
| tree | f9734fd5e7349c233c1acd5d79957d990fbd78b1 /internal | |
| parent | f41b0b92046e1bee512b3e4143ed9dc9a9ba9713 (diff) | |
| download | galleryd-d87995c3629cac4671b05073915214f45d0c7112.tar.xz galleryd-d87995c3629cac4671b05073915214f45d0c7112.zip | |
refactor(api): centralize resource URLs
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/api/photos.go | 4 | ||||
| -rw-r--r-- | internal/api/url.go | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/internal/api/photos.go b/internal/api/photos.go index 2d492b1..92c5c04 100644 --- a/internal/api/photos.go +++ b/internal/api/photos.go @@ -30,8 +30,8 @@ func (s *Server) handlePhotos( DateTaken: photo.DateTaken, Width: photo.Width, Height: photo.Height, - ThumbnailURL: "/thumb/" + photo.ID, - PhotoURL: "/photo/" + photo.ID, + ThumbnailURL: thumbnailURL(photo.ID), + PhotoURL: photoURL(photo.ID), }) } diff --git a/internal/api/url.go b/internal/api/url.go new file mode 100644 index 0000000..06a944d --- /dev/null +++ b/internal/api/url.go @@ -0,0 +1,9 @@ +package api + +func thumbnailURL(id string) string { + return "/thumb/" + id +} + +func photoURL(id string) string { + return "/photo/" + id +} |