all repos — flounder @ 86a61da02cf55281d79d6f2b4b86806f2de3496a

A small site builder for the Gemini protocol

Use servecontent to serve user gemini content
alex wennerberg alex@alexwennerberg.com
Wed, 10 Feb 2021 21:13:08 -0800
commit

86a61da02cf55281d79d6f2b4b86806f2de3496a

parent

40770ad0c9b1946955266c1c4bc69c86b1d79ddb

1 files changed, 5 insertions(+), 2 deletions(-)

jump to
M http.gohttp.go

@@ -629,11 +629,14 @@ URI *url.URL

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 @@ hostname := s[0]

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)