mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
* Fix relative URLs * Improve login base URL and redirects * Prevent duplicate customlocales requests * Improve UI base URL handling * Improve UI embedding * Improve CSP header * Add Cache-Control headers to all responses * Improve CORS responses * Improve authentication handler * Add back media timestamp suffixes * Fix default image handling * Add default param to other image URLs
29 lines
650 B
Go
29 lines
650 B
Go
package urlbuilders
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/stashapp/stash/pkg/models"
|
|
)
|
|
|
|
type ImageURLBuilder struct {
|
|
BaseURL string
|
|
ImageID string
|
|
UpdatedAt string
|
|
}
|
|
|
|
func NewImageURLBuilder(baseURL string, image *models.Image) ImageURLBuilder {
|
|
return ImageURLBuilder{
|
|
BaseURL: baseURL,
|
|
ImageID: strconv.Itoa(image.ID),
|
|
UpdatedAt: strconv.FormatInt(image.UpdatedAt.Unix(), 10),
|
|
}
|
|
}
|
|
|
|
func (b ImageURLBuilder) GetImageURL() string {
|
|
return b.BaseURL + "/image/" + b.ImageID + "/image?t=" + b.UpdatedAt
|
|
}
|
|
|
|
func (b ImageURLBuilder) GetThumbnailURL() string {
|
|
return b.BaseURL + "/image/" + b.ImageID + "/thumbnail?t=" + b.UpdatedAt
|
|
}
|