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
}
func killzone(w http.ResponseWriter, r *http.Request) {
func zonkzone(w http.ResponseWriter, r *http.Request) {
db := opendatabase()
userinfo := login.GetUserInfo(r)
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["Zonkers"] = zonkers
templinfo["KillCSRF"] = login.GetCSRF("killitwithfire", r)
templinfo["ZonkCSRF"] = login.GetCSRF("zonkzonk", r)
err = readviews.Execute(w, "zonkers.html", templinfo)
if err != nil {
log.Print(err)
}
}
func killitwithfire(w http.ResponseWriter, r *http.Request) {
func zonkzonk(w http.ResponseWriter, r *http.Request) {
userinfo := login.GetUserInfo(r)
itsok := r.FormValue("itsok")
if itsok == "iforgiveyou" {
@ -1087,7 +1087,7 @@ func killitwithfire(w http.ResponseWriter, r *http.Request) {
db.Exec("delete from zonkers where userid = ? and zonkerid = ?",
userinfo.UserID, zonkerid)
bitethethumbs()
http.Redirect(w, r, "/killzone", http.StatusSeeOther)
http.Redirect(w, r, "/zonkzone", http.StatusSeeOther)
return
}
wherefore := r.FormValue("wherefore")
@ -1110,7 +1110,7 @@ func killitwithfire(w http.ResponseWriter, r *http.Request) {
bitethethumbs()
}
http.Redirect(w, r, "/killzone", http.StatusSeeOther)
http.Redirect(w, r, "/zonkzone", http.StatusSeeOther)
}
func accountpage(w http.ResponseWriter, r *http.Request) {
@ -1299,11 +1299,11 @@ func serve() {
loggedin.HandleFunc("/account", accountpage)
loggedin.HandleFunc("/chpass", dochpass)
loggedin.HandleFunc("/atme", homepage)
loggedin.HandleFunc("/killzone", killzone)
loggedin.HandleFunc("/zonkzone", zonkzone)
loggedin.Handle("/honk", login.CSRFWrap("honkhonk", http.HandlerFunc(savehonk)))
loggedin.Handle("/bonk", login.CSRFWrap("honkhonk", http.HandlerFunc(savebonk)))
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.HandleFunc("/honkers", showhonkers)
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="/honkers">honkers</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>
{{ else }}
{{ if .ShowRSS }}

View File

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