Skip to content

Commit

Permalink
Get direct/gallery from header too
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Nov 1, 2024
1 parent 0ae9f64 commit f0dd30e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions handlers/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ func Embed(w http.ResponseWriter, r *http.Request) {
isDirect, _ := strconv.ParseBool(urlQuery.Get("direct"))
isGallery, _ := strconv.ParseBool(urlQuery.Get("gallery"))

// Get direct/gallery from header too, nginx query params is pain in the ass
embedType := r.Header.Get("X-Embed-Type")
if embedType == "direct" {
isDirect = true
} else if embedType == "gallery" {
isGallery = true
}

// Stories use mediaID (int) instead of postID
if strings.Contains(r.URL.Path, "/stories/") {
mediaID, err := strconv.Atoi(postID)
Expand Down

0 comments on commit f0dd30e

Please sign in to comment.