diff --git a/docs/changelog.txt b/docs/changelog.txt index a021a3a..a4d8b81 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,8 @@ changelog -- next ++ More JS free fallbacks for some basic functions. + + Add chpass command. + Improved honker management. diff --git a/views/honk.html b/views/honk.html index f3cdb08..8aecc06 100644 --- a/views/honk.html +++ b/views/honk.html @@ -92,25 +92,25 @@ in reply to: {{ .RID }}

{{ if .Honk.Public }} {{ if .Honk.IsBonked }} - + {{ else }} - + {{ end }} {{ else }} {{ end }} - - - + + + {{ if .Honk.IsAcked }} - + {{ else }} - + {{ end }} {{ if .Honk.IsSaved }} - + {{ else }} - + {{ end }} diff --git a/views/honkform.html b/views/honkform.html index 0a02951..812454d 100644 --- a/views/honkform.html +++ b/views/honkform.html @@ -1,5 +1,5 @@

- +

diff --git a/views/honkpage.js b/views/honkpage.js index 91a9217..3888a65 100644 --- a/views/honkpage.js +++ b/views/honkpage.js @@ -22,7 +22,8 @@ function get(url, whendone) { function bonk(el, xid) { el.innerHTML = "bonked" el.disabled = true - post("/bonk", encode({"CSRF": csrftoken, "xid": xid})) + post("/bonk", encode({"js": "2", "CSRF": csrftoken, "xid": xid})) + return false } function unbonk(el, xid) { el.innerHTML = "unbonked" @@ -238,6 +239,7 @@ function showhonkform(elem, rid, hname) { honknoise.value = "@" + hname + " " } document.getElementById("honknoise").focus() + return false } function showelement(id) { var el = document.getElementById(id) diff --git a/web.go b/web.go index bde3aba..73a328d 100644 --- a/web.go +++ b/web.go @@ -848,6 +848,15 @@ func submitbonk(w http.ResponseWriter, r *http.Request) { } go honkworldwide(user, &bonk) + + if r.FormValue("js") != "1" { + templinfo := getInfo(r) + templinfo["ServerMessage"] = "Bonked!" + err = readviews.Execute(w, "msg.html", templinfo) + if err != nil { + log.Print(err) + } + } } func sendzonkofsorts(xonk *Honk, user *WhatAbout, what string) { @@ -983,6 +992,31 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) { } } +func newhonkpage(w http.ResponseWriter, r *http.Request) { + u := login.GetUserInfo(r) + rid := r.FormValue("rid") + noise := "" + + xonk := getxonk(u.UserID, rid) + if xonk != nil { + _, replto := handles(xonk.Honker) + if replto != "" { + noise = "@" + replto + " " + } + } + + templinfo := getInfo(r) + templinfo["HonkCSRF"] = login.GetCSRF("honkhonk", r) + templinfo["InReplyTo"] = rid + templinfo["Noise"] = noise + templinfo["ServerMessage"] = "compose honk" + templinfo["IsPreview"] = true + err := readviews.Execute(w, "honkpage.html", templinfo) + if err != nil { + log.Print(err) + } +} + func canedithonk(user *WhatAbout, honk *Honk) bool { if honk == nil || honk.Honker != user.URL || honk.What == "bonk" { return false @@ -1686,6 +1720,7 @@ func serve() { "views/funzone.html", "views/login.html", "views/xzone.html", + "views/msg.html", "views/header.html", "views/onts.html", "views/honkpage.js", @@ -1743,6 +1778,7 @@ func serve() { loggedin.HandleFunc("/atme", homepage) loggedin.HandleFunc("/hfcs", hfcspage) loggedin.HandleFunc("/xzone", xzone) + loggedin.HandleFunc("/newhonk", newhonkpage) loggedin.HandleFunc("/edit", edithonkpage) loggedin.Handle("/honk", login.CSRFWrap("honkhonk", http.HandlerFunc(submithonk))) loggedin.Handle("/bonk", login.CSRFWrap("honkhonk", http.HandlerFunc(submitbonk)))