flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 6c814bb3f1ed4320bc0a072caeaaac83fd653673
parent 8d930b0741c22b9c3453beae9d7892b1191be4e2
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 10 Feb 2021 20:47:53 -0800

Improve proxy

Diffstat:
Mproxy.go | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/proxy.go b/proxy.go @@ -109,7 +109,9 @@ func proxyGemini(w http.ResponseWriter, r *http.Request) { return } - if m != "text/gemini" { + _, raw := r.URL.Query()["raw"] + acceptsGemini := strings.Contains(r.Header.Get("Accept"), "text/gemini") + if m != "text/gemini" || raw || acceptsGemini { w.Header().Add("Content-Type", resp.Meta) io.Copy(w, resp.Body) return @@ -128,7 +130,7 @@ func proxyGemini(w http.ResponseWriter, r *http.Request) { GeminiURI *url.URL URI *url.URL Config Config - }{template.HTML(htmlDoc.Content), "", r.URL.String(), req.URL, r.URL, c} + }{template.HTML(htmlDoc.Content), "", htmlDoc.Title, req.URL, r.URL, c} err = t.ExecuteTemplate(w, "user_page.html", data) if err != nil {