From f0dd30e601d32c0070fb00b48f8cdd595fa978d6 Mon Sep 17 00:00:00 2001 From: Akmal <72781956+Wikidepia@users.noreply.github.com> Date: Fri, 1 Nov 2024 20:52:13 +0700 Subject: [PATCH] Get direct/gallery from header too --- handlers/embed.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/handlers/embed.go b/handlers/embed.go index ab9d26c..ebaebbb 100644 --- a/handlers/embed.go +++ b/handlers/embed.go @@ -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)