killing is mean. zonking is nicer.

This commit is contained in:
Ted Unangst 2019-06-01 22:58:46 -04:00
parent ce850eb0cb
commit 06b22605cb
3 changed files with 15 additions and 15 deletions

14
honk.go
View File

@ -1055,7 +1055,7 @@ type Zonker struct {
Wherefore string Wherefore string
} }
func killzone(w http.ResponseWriter, r *http.Request) { func zonkzone(w http.ResponseWriter, r *http.Request) {
db := opendatabase() db := opendatabase()
userinfo := login.GetUserInfo(r) userinfo := login.GetUserInfo(r)
rows, err := db.Query("select zonkerid, name, wherefore from zonkers where userid = ?", userinfo.UserID) rows, err := db.Query("select zonkerid, name, wherefore from zonkers where userid = ?", userinfo.UserID)
@ -1071,14 +1071,14 @@ func killzone(w http.ResponseWriter, r *http.Request) {
} }
templinfo := getInfo(r) templinfo := getInfo(r)
templinfo["Zonkers"] = zonkers templinfo["Zonkers"] = zonkers
templinfo["KillCSRF"] = login.GetCSRF("killitwithfire", r) templinfo["ZonkCSRF"] = login.GetCSRF("zonkzonk", r)
err = readviews.Execute(w, "zonkers.html", templinfo) err = readviews.Execute(w, "zonkers.html", templinfo)
if err != nil { if err != nil {
log.Print(err) log.Print(err)
} }
} }
func killitwithfire(w http.ResponseWriter, r *http.Request) { func zonkzonk(w http.ResponseWriter, r *http.Request) {
userinfo := login.GetUserInfo(r) userinfo := login.GetUserInfo(r)
itsok := r.FormValue("itsok") itsok := r.FormValue("itsok")
if itsok == "iforgiveyou" { if itsok == "iforgiveyou" {
@ -1087,7 +1087,7 @@ func killitwithfire(w http.ResponseWriter, r *http.Request) {
db.Exec("delete from zonkers where userid = ? and zonkerid = ?", db.Exec("delete from zonkers where userid = ? and zonkerid = ?",
userinfo.UserID, zonkerid) userinfo.UserID, zonkerid)
bitethethumbs() bitethethumbs()
http.Redirect(w, r, "/killzone", http.StatusSeeOther) http.Redirect(w, r, "/zonkzone", http.StatusSeeOther)
return return
} }
wherefore := r.FormValue("wherefore") wherefore := r.FormValue("wherefore")
@ -1110,7 +1110,7 @@ func killitwithfire(w http.ResponseWriter, r *http.Request) {
bitethethumbs() bitethethumbs()
} }
http.Redirect(w, r, "/killzone", http.StatusSeeOther) http.Redirect(w, r, "/zonkzone", http.StatusSeeOther)
} }
func accountpage(w http.ResponseWriter, r *http.Request) { func accountpage(w http.ResponseWriter, r *http.Request) {
@ -1299,11 +1299,11 @@ func serve() {
loggedin.HandleFunc("/account", accountpage) loggedin.HandleFunc("/account", accountpage)
loggedin.HandleFunc("/chpass", dochpass) loggedin.HandleFunc("/chpass", dochpass)
loggedin.HandleFunc("/atme", homepage) loggedin.HandleFunc("/atme", homepage)
loggedin.HandleFunc("/killzone", killzone) loggedin.HandleFunc("/zonkzone", zonkzone)
loggedin.Handle("/honk", login.CSRFWrap("honkhonk", http.HandlerFunc(savehonk))) loggedin.Handle("/honk", login.CSRFWrap("honkhonk", http.HandlerFunc(savehonk)))
loggedin.Handle("/bonk", login.CSRFWrap("honkhonk", http.HandlerFunc(savebonk))) loggedin.Handle("/bonk", login.CSRFWrap("honkhonk", http.HandlerFunc(savebonk)))
loggedin.Handle("/zonkit", login.CSRFWrap("honkhonk", http.HandlerFunc(zonkit))) loggedin.Handle("/zonkit", login.CSRFWrap("honkhonk", http.HandlerFunc(zonkit)))
loggedin.Handle("/killitwithfire", login.CSRFWrap("killitwithfire", http.HandlerFunc(killitwithfire))) loggedin.Handle("/zonkzonk", login.CSRFWrap("zonkzonk", http.HandlerFunc(zonkzonk)))
loggedin.Handle("/saveuser", login.CSRFWrap("saveuser", http.HandlerFunc(saveuser))) loggedin.Handle("/saveuser", login.CSRFWrap("saveuser", http.HandlerFunc(saveuser)))
loggedin.HandleFunc("/honkers", showhonkers) loggedin.HandleFunc("/honkers", showhonkers)
loggedin.HandleFunc("/h/{name:[[:alnum:]]+}", showhonker) loggedin.HandleFunc("/h/{name:[[:alnum:]]+}", showhonker)

View File

@ -17,7 +17,7 @@
<span><a href="/u/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a></span> <span><a href="/u/{{ .UserInfo.Username }}">{{ .UserInfo.Username }}</a></span>
<span><a href="/honkers">honkers</a></span> <span><a href="/honkers">honkers</a></span>
<span><a href="/c">combos</a></span> <span><a href="/c">combos</a></span>
<span><a href="/killzone">killzone</a></span> <span><a href="/zonkzone">zonkzone</a></span>
<span><a href="/account">account</a></span> <span><a href="/account">account</a></span>
{{ else }} {{ else }}
{{ if .ShowRSS }} {{ if .ShowRSS }}

View File

@ -2,9 +2,9 @@
<main> <main>
<div class="info"> <div class="info">
<p> <p>
<form action="/killitwithfire" method="POST"> <form action="/zonkzonk" method="POST">
<span class="title">kill another zonker</span> <span class="title">it's zonking time!</span>
<input type="hidden" name="CSRF" value="{{ .KillCSRF }}"> <input type="hidden" name="CSRF" value="{{ .ZonkCSRF }}">
<p> <p>
<input tabindex=1 type="text" name="name" value="" autocomplete=off> - name <input tabindex=1 type="text" name="name" value="" autocomplete=off> - name
<p> <p>
@ -19,16 +19,16 @@
<p> <p>
<input type="radio" id="iszword" name="wherefore" value="zword"> <input type="radio" id="iszword" name="wherefore" value="zword">
<label for="iszword">Zword</label> <label for="iszword">Zword</label>
<p><input tabindex=1 type="submit" name="kill" value="kill"> <p><br><input tabindex=1 type="submit" name="zonk" value="zonk!">
</form> </form>
</div> </div>
{{ $killcsrf := .KillCSRF }} {{ $zonkcsrf := .ZonkCSRF }}
{{ range .Zonkers }} {{ range .Zonkers }}
<section class="honk"> <section class="honk">
<p>What: {{ .Name }} <p>What: {{ .Name }}
<p>Where: {{ .Wherefore }} <p>Where: {{ .Wherefore }}
<form action="/killitwithfire" method="POST"> <form action="/zonkzonk" method="POST">
<input type="hidden" name="CSRF" value="{{ $killcsrf }}"> <input type="hidden" name="CSRF" value="{{ $zonkcsrf }}">
<input type="hidden" name="zonkerid" value="{{ .ID }}"> <input type="hidden" name="zonkerid" value="{{ .ID }}">
<input type="hidden" name="itsok" value="iforgiveyou"> <input type="hidden" name="itsok" value="iforgiveyou">
<input type="submit" name="pardon" value="pardon"> <input type="submit" name="pardon" value="pardon">