flounder

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

commit 86a61da02cf55281d79d6f2b4b86806f2de3496a
parent 40770ad0c9b1946955266c1c4bc69c86b1d79ddb
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 10 Feb 2021 21:13:08 -0800

Use servecontent to serve user gemini content

Diffstat:
Mhttp.go | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/http.go b/http.go @@ -629,11 +629,14 @@ func userFile(w http.ResponseWriter, r *http.Request) { GeminiURI *url.URL Config Config }{template.HTML(htmlDoc.Content), favicon, htmlDoc.Title, &uri, &uri, c} - err = t.ExecuteTemplate(w, "user_page.html", data) + buff := bytes.NewBuffer([]byte{}) + err = t.ExecuteTemplate(buff, "user_page.html", data) if err != nil { serverError(w, err) return } + breader := bytes.NewReader(buff.Bytes()) + http.ServeContent(w, r, "", stat.ModTime(), breader) } else { http.ServeFile(w, r, fullPath) } @@ -783,7 +786,7 @@ func runHTTPServer() { serveMux.HandleFunc(hostname+"/", rootHandler) serveMux.HandleFunc(hostname+"/my_site", mySiteHandler) - serveMux.HandleFunc(hostname+"/me", limit(myAccountHandler)) + serveMux.HandleFunc(hostname+"/me", myAccountHandler) serveMux.HandleFunc(hostname+"/my_site/flounder-archive.zip", archiveHandler) serveMux.HandleFunc(hostname+"/admin", adminHandler) serveMux.HandleFunc(hostname+"/edit/", editFileHandler)