mirror of
https://github.com/stashapp/stash.git
synced 2025-12-10 10:22:18 +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
32 lines
748 B
Go
32 lines
748 B
Go
package urlbuilders
|
|
|
|
import (
|
|
"github.com/stashapp/stash/pkg/models"
|
|
"strconv"
|
|
)
|
|
|
|
type MovieURLBuilder struct {
|
|
BaseURL string
|
|
MovieID string
|
|
UpdatedAt string
|
|
}
|
|
|
|
func NewMovieURLBuilder(baseURL string, movie *models.Movie) MovieURLBuilder {
|
|
return MovieURLBuilder{
|
|
BaseURL: baseURL,
|
|
MovieID: strconv.Itoa(movie.ID),
|
|
UpdatedAt: strconv.FormatInt(movie.UpdatedAt.Timestamp.Unix(), 10),
|
|
}
|
|
}
|
|
|
|
func (b MovieURLBuilder) GetMovieFrontImageURL(hasImage bool) string {
|
|
url := b.BaseURL + "/movie/" + b.MovieID + "/frontimage?t=" + b.UpdatedAt
|
|
if !hasImage {
|
|
url += "&default=true"
|
|
}
|
|
return url
|
|
}
|
|
|
|
func (b MovieURLBuilder) GetMovieBackImageURL() string {
|
|
return b.BaseURL + "/movie/" + b.MovieID + "/backimage?t=" + b.UpdatedAt
|
|
}
|