all repos — honk @ 882217f61ebb0f3f2d47f49067bc6df4642528c1

my fork of honk

some more consistency with cache control that's drifted over time
Ted Unangst tedu@tedunangst.com
Wed, 23 Oct 2019 17:58:45 -0400
commit

882217f61ebb0f3f2d47f49067bc6df4642528c1

parent

9a8f430bb71aa3cc2efa41df24c13b8765ff098d

1 files changed, 9 insertions(+), 6 deletions(-)

jump to
M web.goweb.go

@@ -760,9 +760,6 @@ var userid int64 = -1

if u != nil { userid = u.UserID } - if u == nil { - w.Header().Set("Cache-Control", "max-age=60") - } reverbolate(userid, honks) templinfo["Honks"] = honks if templinfo["TopHID"] == nil {

@@ -771,6 +768,9 @@ templinfo["TopHID"] = honks[0].ID

} else { templinfo["TopHID"] = 0 } + } + if u == nil { + w.Header().Set("Cache-Control", "max-age=60") } err := readviews.Execute(w, "honkpage.html", templinfo) if err != nil {

@@ -1548,7 +1548,6 @@ l["type"] = `application/activity+json`

l["href"] = user.URL j["links"] = []junk.Junk{l} - w.Header().Set("Cache-Control", "max-age=3600") w.Header().Set("Content-Type", "application/jrd+json") j.Write(w) }

@@ -1572,7 +1571,7 @@ http.NotFound(w, r)

return } defer fd.Close() - w.Header().Set("Cache-Control", "max-age=0") + w.Header().Set("Cache-Control", "max-age=7776000") w.Header().Set("Content-Type", "text/css; charset=utf-8") err = css.Filter(fd, w) if err != nil {

@@ -1585,13 +1584,17 @@ http.ServeFile(w, r, "views"+r.URL.Path)

} func servehelp(w http.ResponseWriter, r *http.Request) { name := mux.Vars(r)["name"] - w.Header().Set("Cache-Control", "max-age=600") + w.Header().Set("Cache-Control", "max-age=3600") http.ServeFile(w, r, "docs/"+name) } func servehtml(w http.ResponseWriter, r *http.Request) { + u := login.GetUserInfo(r) templinfo := getInfo(r) templinfo["AboutMsg"] = aboutMsg templinfo["LoginMsg"] = loginMsg + if u == nil { + w.Header().Set("Cache-Control", "max-age=60") + } err := readviews.Execute(w, r.URL.Path[1:]+".html", templinfo) if err != nil { log.Print(err)