all repos — honk @ 7a38ba1025bef4ec2bac4b370814acc1533ad381

my fork of honk

remove wonk support
Ted Unangst tedu@tedunangst.com
Tue, 07 Feb 2023 20:35:38 -0500
commit

7a38ba1025bef4ec2bac4b370814acc1533ad381

parent

91d3b49704cfcb6071dd09ac900aad8037373945

M activity.goactivity.go

@@ -687,8 +687,6 @@ what = "move"

case "Page": waspage = true fallthrough - case "GuessWord": // dealt with below - fallthrough case "Audio": fallthrough case "Image":

@@ -819,12 +817,6 @@ }

if ot == "Move" { targ, _ := obj.GetString("target") content += string(templates.Sprintf(`<p>Moved to <a href="%s">%s</a>`, targ, targ)) - } - if ot == "GuessWord" { - what = "wonk" - content, _ = obj.GetString("content") - xonk.Wonkles, _ = obj.GetString("wordlist") - go savewonkles(xonk.Wonkles) } if what == "honk" && rid != "" { what = "tonk"

@@ -1181,8 +1173,6 @@ case "tonk":

fallthrough case "event": fallthrough - case "wonk": - fallthrough case "honk": j["type"] = "Create" jo = junk.New()

@@ -1190,8 +1180,6 @@ jo["id"] = h.XID

jo["type"] = "Note" if h.What == "event" { jo["type"] = "Event" - } else if h.What == "wonk" { - jo["type"] = "GuessWord" } if h.What == "update" { j["type"] = "Update"

@@ -1297,9 +1285,6 @@ jo["startTime"] = t.StartTime.Format(time.RFC3339)

if t.Duration != 0 { jo["duration"] = "PT" + strings.ToUpper(t.Duration.String()) } - } - if w := h.Wonkles; w != "" { - jo["wordlist"] = w } atts := activatedonks(h.Donks) if len(atts) > 0 {
M bloat.gobloat.go

@@ -14,54 +14,3 @@ // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF

// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. package main - -import ( - "net/http" - "strings" - - "humungus.tedunangst.com/r/webs/junk" -) - -func servewonkles(w http.ResponseWriter, r *http.Request) { - url := r.FormValue("w") - dlog.Printf("getting wordlist: %s", url) - wonkles := getxonker(url, "wonkles") - if wonkles == "" { - wonkles = savewonkles(url) - if wonkles == "" { - http.NotFound(w, r) - return - } - } - var words []string - for _, l := range strings.Split(wonkles, "\n") { - words = append(words, l) - } - if !develMode { - w.Header().Set("Cache-Control", "max-age=7776000") - } - - j := junk.New() - j["wordlist"] = words - j.Write(w) -} - -func savewonkles(url string) string { - w := getxonker(url, "wonkles") - if w != "" { - return w - } - ilog.Printf("fetching wonkles: %s", url) - res, err := fetchsome(url) - if err != nil { - ilog.Printf("error fetching wonkles: %s", err) - return "" - } - w = getxonker(url, "wonkles") - if w != "" { - return w - } - w = string(res) - savexonker(url, w, "wonkles", "") - return w -}
M database.godatabase.go

@@ -485,9 +485,7 @@ elog.Printf("error parsing badonks: %s", err)

continue } case "wonkles": - h.Wonkles = j case "guesses": - h.Guesses = template.HTML(j) case "oldrev": default: elog.Printf("unknown meta genus: %s", genus)

@@ -894,20 +892,6 @@ _, err = tx.Stmt(stmtSaveMeta).Exec(h.ID, "mentions", j)

} if err != nil { elog.Printf("error saving mentions: %s", err) - return err - } - } - if w := h.Wonkles; w != "" { - _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "wonkles", w) - if err != nil { - elog.Printf("error saving wonkles: %s", err) - return err - } - } - if g := h.Guesses; g != "" { - _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "guesses", g) - if err != nil { - elog.Printf("error saving guesses: %s", err) return err } }
M docs/activitypub.7docs/activitypub.7

@@ -54,13 +54,6 @@ .It Vt Video

Limited support. .It Vt Audio Limited Support. -.It Vt GuessWord -Guess the word game. -(Unofficial extension.) -The solution is stored in -.Fa content -with the possible words, one per line, in a file located at -.Fa wordlist . .El .Pp Honk primarily supports HTML content, not markdown or other formats,
M docs/changelog.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

=== next ++ Remove the wonk support. Fun's over, back to work. + + All inclusive danger zone spoiler alerts. + Emu peeker
M fun.gofun.go

@@ -181,9 +181,6 @@ renderflags(h)

h.HTPrecis = template.HTML(h.Precis) h.HTML = template.HTML(h.Noise) - if h.What == "wonked" { - h.HTML = "? wonk ?" - } if redo := relingo[h.What]; redo != "" { h.What = redo }
M honk.gohonk.go

@@ -104,8 +104,6 @@ Place *Place

Time *Time Mentions []Mention Badonks []Badonk - Wonkles string - Guesses template.HTML } type Badonk struct {

@@ -178,10 +176,6 @@ }

func (honk *Honk) IsReacted() bool { return honk.Flags&flagIsReacted != 0 -} - -func (honk *Honk) IsWonked() bool { - return honk.Flags&flagIsWonked != 0 } type Donk struct {
M views/honk.htmlviews/honk.html

@@ -89,15 +89,6 @@ {{ end }}

{{ end }} </details> {{ end }} -{{ if eq .Honk.What "wonked" }} -<p> -{{ if and $bonkcsrf .Honk.IsWonked }} -{{ .Honk.Guesses }} -<p>{{ .Honk.Noise }} -{{ else }} -<button class="playit" data-noise="{{ .Honk.Noise }}" data-wonk="{{ .Honk.Wonkles }}">it's play time!</button> -{{ end }} -{{ end }} {{ if and $bonkcsrf (not $IsPreview) }} <p> <details class="actions">
M views/honkpage.jsviews/honkpage.js

@@ -337,12 +337,6 @@ } else if (el.classList.contains("flogit-react")) {

el.onclick = function() { flogit(el, "react", xid); } - } else if (el.classList.contains("playit")) { - var noise = el.dataset.noise - var wonk = el.dataset.wonk - el.onclick = function() { - playit(el, noise, wonk, xid) - } } }) }

@@ -421,12 +415,6 @@ el = document.getElementById("placenameinput")

el.value = err.message }, gpsoptions) } -} -function playit(elem, word, wordlist, xid) { - import('/wonk.js').then(module => { - makeaguess = module.makeaguess - module.addguesscontrols(elem, word, wordlist, xid) - }) } function addemu(elem) { const data = elem.alt
D views/wonk.js

@@ -1,89 +0,0 @@

-export function addguesscontrols(elem, word, wordlist, xid) { - var host = elem.parentElement - elem.innerHTML = "loading..." - - host.correctAnswer = word - host.guesses = [] - host.xid = xid - var xhr = new XMLHttpRequest() - xhr.open("GET", "/bloat/wonkles?w=" + encodeURIComponent(wordlist)) - xhr.responseType = "json" - xhr.onload = function() { - var wordlist = xhr.response.wordlist - var validguesses = {} - console.log("valid " + wordlist.length) - for (var i = 0; i < wordlist.length; i++) { - validguesses[wordlist[i]] = true - } - host.validGuesses = validguesses - var div = document.createElement( 'div' ); - div.innerHTML = "<p><input> <button>guess</button>" - div.querySelector('button').onclick = function() { - makeaguess(this) - } - host.append(div) - elem.remove() - } - xhr.send() -} -export function makeaguess(btn) { - var host = btn.parentElement.parentElement.parentElement - var correct = host.correctAnswer - var valid = host.validGuesses - var inp = btn.previousElementSibling - var g = inp.value.toLowerCase() - var res = "" - if (valid[g]) { - var letters = {} - var obfu = "" - for (var i = 0; i < correct.length; i++) { - var l = correct[i] - letters[l] = (letters[l] | 0) + 1 - } - for (var i = 0; i < g.length && i < correct.length; i++) { - if (g[i] == correct[i]) { - letters[g[i]] = letters[g[i]] - 1 - } - } - for (var i = 0; i < g.length; i++) { - if (i < correct.length && g[i] == correct[i]) { - res += g[i].toUpperCase() - obfu += "&#129001;" - } else if (letters[g[i]] > 0) { - res += g[i] - obfu += "&#129000;" - letters[g[i]] = letters[g[i]] - 1 - } else { - obfu += "&#11035;" - res += "." - } - } - - var div = document.createElement( 'div' ); - div.innerHTML = "<p class='fontmonospace'>" + res - host.append(div) - host.guesses.push(obfu) - } else { - var div = document.createElement( 'div' ); - div.innerHTML = "<p> invalid guess" - host.append(div) - } - var div = document.createElement( 'div' ); - if (res == correct.toUpperCase()) { - var mess = "<p>you are very smart!" - mess += "<p>" + host.xid - for (var i = 0; i < host.guesses.length; i++) { - mess += "<p>" + host.guesses[i] - } - div.innerHTML = mess - if (typeof(csrftoken) != "undefined") - post("/zonkit", encode({"CSRF": csrftoken, "wherefore": "wonk", "guesses": host.guesses.join("<p>"), "what": host.xid})) - } else { - div.innerHTML = "<p><input> <button>guess</button>" - div.querySelector('button').onclick = function() { - makeaguess(this) - } - } - host.append(div) - btn.parentElement.remove() -}
M web.goweb.go

@@ -1330,21 +1330,6 @@ }

return } - if wherefore == "wonk" { - xonk := getxonk(userinfo.UserID, what) - if xonk != nil { - _, err := stmtUpdateFlags.Exec(flagIsWonked, xonk.ID) - if err == nil { - guesses := r.FormValue("guesses") - _, err = stmtSaveMeta.Exec(xonk.ID, "guesses", guesses) - } - if err != nil { - elog.Printf("error saving: %s", err) - } - } - return - } - // my hammer is too big, oh well defer oldjonks.Flush()

@@ -1620,10 +1605,6 @@ what := "honk"

if rid != "" { what = "tonk" } - wonkles := r.FormValue("wonkles") - if wonkles != "" { - what = "wonk" - } honk = &Honk{ UserID: userinfo.UserID, Username: userinfo.Username,

@@ -1632,7 +1613,6 @@ Honker: user.URL,

XID: xid, Date: dt, Format: format, - Wonkles: wonkles, } }

@@ -2553,7 +2533,6 @@ posters.HandleFunc("/inbox", serverinbox)

getters.HandleFunc("/style.css", serveviewasset) getters.HandleFunc("/honkpage.js", serveviewasset) - getters.HandleFunc("/wonk.js", serveviewasset) getters.HandleFunc("/misc.js", serveviewasset) getters.HandleFunc("/local.css", servedataasset) getters.HandleFunc("/local.js", servedataasset)

@@ -2565,8 +2544,6 @@ getters.HandleFunc("/login", servehtml)

posters.HandleFunc("/dologin", login.LoginFunc) getters.HandleFunc("/logout", login.LogoutFunc) getters.HandleFunc("/help/{name:[\\pL[:digit:]_.-]+}", servehelp) - - getters.HandleFunc("/bloat/wonkles", servewonkles) loggedin := mux.NewRoute().Subrouter() loggedin.Use(login.Required)