From ed7e687370b72c2c9ee18b51e8f7f3ca4fd7c428 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 5 Sep 2019 17:29:40 -0400 Subject: [PATCH] this is extremely messy, but allow hotswap between /home and /atme --- honk.go | 7 ++--- views/header.html | 4 +-- views/honkfrags.html | 2 ++ views/honkpage.html | 61 ++++++++++++++++++++++++++++++++++++-------- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/honk.go b/honk.go index 65685ac..ea5459e 100644 --- a/honk.go +++ b/honk.go @@ -173,9 +173,9 @@ func homepage(w http.ResponseWriter, r *http.Request) { } else { honks = gethonksforuser(userid) honks = osmosis(honks, userid) - if len(honks) > 0 { - templinfo["TopXID"] = honks[0].XID - } + } + if len(honks) > 0 { + templinfo["TopXID"] = honks[0].XID } templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) } @@ -1715,6 +1715,7 @@ func serve() { getters := mux.Methods("GET").Subrouter() getters.HandleFunc("/", homepage) + getters.HandleFunc("/home", homepage) getters.HandleFunc("/front", homepage) getters.HandleFunc("/robots.txt", nomoroboto) getters.HandleFunc("/rss", showrss) diff --git a/views/header.html b/views/header.html index a43d860..88aa87c 100644 --- a/views/header.html +++ b/views/header.html @@ -14,9 +14,9 @@
-honk +honk {{ if .UserInfo }} -@me +@me {{ .UserInfo.Username }} honkers combos diff --git a/views/honkfrags.html b/views/honkfrags.html index 1b3ea44..ad9ba6d 100644 --- a/views/honkfrags.html +++ b/views/honkfrags.html @@ -1,5 +1,7 @@
{{ .TopXID }}
{{ $BonkCSRF := .HonkCSRF }} +
{{ range .Honks }} {{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }} {{ end }} +
diff --git a/views/honkpage.html b/views/honkpage.html index c4ebc60..a71bb7a 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -14,31 +14,70 @@ {{ if .TopXID }}

{{ end }} +
{{ range .Honks }} {{ template "honk.html" map "Honk" . "BonkCSRF" $BonkCSRF }} {{ end }} +
{{ if $BonkCSRF }}