From c4b14dd51398ce48fc930f14d418f8f024d4570c Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 16 Apr 2019 22:23:50 -0400 Subject: [PATCH] add some caching times willy nilly --- honk.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/honk.go b/honk.go index 51fe85f..6aea291 100644 --- a/honk.go +++ b/honk.go @@ -371,6 +371,7 @@ func outbox(w http.ResponseWriter, r *http.Request) { j["totalItems"] = len(jonks) j["orderedItems"] = jonks + w.Header().Set("Cache-Control", "max-age=60") w.Header().Set("Content-Type", theonetruename) WriteJunk(w, j) } @@ -384,6 +385,7 @@ func viewuser(w http.ResponseWriter, r *http.Request) { } if friendorfoe(r.Header.Get("Accept")) { j := asjonker(user) + w.Header().Set("Cache-Control", "max-age=600") w.Header().Set("Content-Type", theonetruename) WriteJunk(w, j) return @@ -444,6 +446,7 @@ func fingerlicker(w http.ResponseWriter, r *http.Request) { links = append(links, l) j["links"] = links + w.Header().Set("Cache-Control", "max-age=3600") w.Header().Set("Content-Type", "application/jrd+json") WriteJunk(w, j) } @@ -464,6 +467,7 @@ func viewhonk(w http.ResponseWriter, r *http.Request) { if friendorfoe(r.Header.Get("Accept")) { _, j := jonkjonk(user, h) j["@context"] = itiswhatitis + w.Header().Set("Cache-Control", "max-age=3600") w.Header().Set("Content-Type", theonetruename) WriteJunk(w, j) return @@ -478,6 +482,9 @@ func honkpage(w http.ResponseWriter, r *http.Request, u *UserInfo, user *WhatAbo templinfo["UserCSRF"] = GetCSRF("saveuser", r) templinfo["HonkCSRF"] = GetCSRF("honkhonk", r) } + if u == nil { + w.Header().Set("Cache-Control", "max-age=60") + } if user != nil { templinfo["Name"] = user.Name whatabout := user.About