mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Add cache breaker for screenshot using modtime (#271)
This commit is contained in:
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
"github.com/stashapp/stash/pkg/api/urlbuilders"
|
||||||
"github.com/stashapp/stash/pkg/manager"
|
"github.com/stashapp/stash/pkg/manager"
|
||||||
"github.com/stashapp/stash/pkg/models"
|
"github.com/stashapp/stash/pkg/models"
|
||||||
@@ -64,7 +65,7 @@ func (r *sceneResolver) File(ctx context.Context, obj *models.Scene) (*models.Sc
|
|||||||
func (r *sceneResolver) Paths(ctx context.Context, obj *models.Scene) (*models.ScenePathsType, error) {
|
func (r *sceneResolver) Paths(ctx context.Context, obj *models.Scene) (*models.ScenePathsType, error) {
|
||||||
baseURL, _ := ctx.Value(BaseURLCtxKey).(string)
|
baseURL, _ := ctx.Value(BaseURLCtxKey).(string)
|
||||||
builder := urlbuilders.NewSceneURLBuilder(baseURL, obj.ID)
|
builder := urlbuilders.NewSceneURLBuilder(baseURL, obj.ID)
|
||||||
screenshotPath := builder.GetScreenshotURL()
|
screenshotPath := builder.GetScreenshotURL(obj.UpdatedAt.Timestamp)
|
||||||
previewPath := builder.GetStreamPreviewURL()
|
previewPath := builder.GetStreamPreviewURL()
|
||||||
streamPath := builder.GetStreamURL()
|
streamPath := builder.GetStreamURL()
|
||||||
webpPath := builder.GetStreamPreviewImageURL()
|
webpPath := builder.GetStreamPreviewImageURL()
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package urlbuilders
|
package urlbuilders
|
||||||
|
|
||||||
import "strconv"
|
import (
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type SceneURLBuilder struct {
|
type SceneURLBuilder struct {
|
||||||
BaseURL string
|
BaseURL string
|
||||||
@@ -30,8 +33,8 @@ func (b SceneURLBuilder) GetSpriteVTTURL() string {
|
|||||||
return b.BaseURL + "/scene/" + b.SceneID + "_thumbs.vtt"
|
return b.BaseURL + "/scene/" + b.SceneID + "_thumbs.vtt"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b SceneURLBuilder) GetScreenshotURL() string {
|
func (b SceneURLBuilder) GetScreenshotURL(updateTime time.Time) string {
|
||||||
return b.BaseURL + "/scene/" + b.SceneID + "/screenshot"
|
return b.BaseURL + "/scene/" + b.SceneID + "/screenshot?" + strconv.FormatInt(updateTime.Unix(), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b SceneURLBuilder) GetChaptersVTTURL() string {
|
func (b SceneURLBuilder) GetChaptersVTTURL() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user