fix (what does that mean anymore) form & pull head
Anirudh Oppiliappan x@icyphox.sh
Wed, 13 Sep 2023 11:58:12 +0300
7 files changed,
74 insertions(+),
10 deletions(-)
M
Makefile
→
Makefile
@@ -9,7 +9,7 @@ @sh ./preflight.sh
help: for m in docs/*.[13578] ; do \ - mandoc -T html -O fragment,man=%N.%S.html $$m | sed -E 's/<a class="Lk" href="([[:alnum:]._-]*)">/<img src="\1"><br>/g' > $$m.html ; \ + mandoc -T html -O style=mandoc.css,man=%N.%S.html $$m | sed -E 's/<a class="Lk" href="([[:alnum:]._-]*)">/<img src="\1"><br>/g' > $$m.html ; \ done clean:
M
backupdb.go
→
backupdb.go
@@ -35,6 +35,7 @@ backup, err := sql.Open("sqlite3", backupdbname)
if err != nil { elog.Fatalf("can't open backup database") } + _, err = backup.Exec("PRAGMA journal_mode=WAL") for _, line := range strings.Split(sqlSchema, ";") { _, err = backup.Exec(line) if err != nil {@@ -76,16 +77,16 @@ rows.Close()
honkids := make(map[int64]bool) for c := range convoys { - rows = qordie(orig, "select honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags from honks where convoy = ?", c) + rows = qordie(orig, "select honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain from honks where convoy = ?", c) for rows.Next() { var honkid, userid int64 - var what, honker, xid, rid, dt, url, audience, noise, convoy string + var what, honker, xid, rid, dt, url, audience, noise, convoy, plain string var whofore int64 var format, precis, oonker string var flags int64 - scanordie(rows, &honkid, &userid, &what, &honker, &xid, &rid, &dt, &url, &audience, &noise, &convoy, &whofore, &format, &precis, &oonker, &flags) + scanordie(rows, &honkid, &userid, &what, &honker, &xid, &rid, &dt, &url, &audience, &noise, &convoy, &whofore, &format, &precis, &oonker, &flags, &plain) honkids[honkid] = true - doordie(tx, "insert into honks (honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags) + doordie(tx, "insert into honks (honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", honkid, userid, what, honker, xid, rid, dt, url, audience, noise, convoy, whofore, format, precis, oonker, flags, plain) } rows.Close() }@@ -169,6 +170,7 @@ blob, err := sql.Open("sqlite3", backupblobname)
if err != nil { elog.Fatalf("can't open backup blob database") } + _, err = blob.Exec("PRAGMA journal_mode=WAL") doordie(blob, "create table filedata (xid text, media text, hash text, content blob)") doordie(blob, "create index idx_filexid on filedata(xid)") doordie(blob, "create index idx_filehash on filedata(hash)")
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,18 @@ changelog
### next ++ Finally fix slow public queries. + +### 1.1.1 Required Refinement + ++ Fix help file stylesheet link. + +### 1.1.0 Eventual Enshittification + ++ Fix backup command. + ++ Fixes for markdown. + + Allow bigger image uploads. + Some hotkeys for the web UI.
M
schema.sql
→
schema.sql
@@ -16,6 +16,7 @@ create index idx_honksxid on honks(xid);
create index idx_honksconvoy on honks(convoy); create index idx_honkshonker on honks(honker); create index idx_honksoonker on honks(oonker); +create index idx_honkswhotwo on honks(whofore) where whofore = 2; create index idx_donkshonk on donks(honkid); create index idx_donkschonk on donks(chonkid); create index idx_honkerxid on honkers(xid);
M
upgradedb.go
→
upgradedb.go
@@ -23,7 +23,7 @@
"humungus.tedunangst.com/r/webs/htfilter" ) -var myVersion = 45 +var myVersion = 46 // idx whotwo type dbexecer interface { Exec(query string, args ...interface{}) (sql.Result, error)@@ -172,6 +172,10 @@ }
tx = nil fallthrough case 45: + try("create index idx_honkswhotwo on honks(whofore) where whofore = 2") + setV(46) + fallthrough + case 46: try("analyze") default:
M
views/honkform.html
→
views/honkform.html
@@ -9,7 +9,7 @@ <p>
<details> <summary>more options</summary> <p> -<label class=button id="donker">attach: <input type="file" multiple name="donk"><span>{{ .SavedFile }}</span></label><input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> +<label class=button id="donker">attach: <input type="file" multiple name="donk"><span>{{ .SavedFile }}</span></label> <input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> <p id="donkdescriptor"><label for=donkdesc>description:</label><br> <input type="text" name="donkdesc" value="{{ .DonkDesc }}" autocomplete=off>
M
web.go
→
web.go
@@ -38,6 +38,7 @@ "unicode/utf8"
"github.com/gorilla/mux" "humungus.tedunangst.com/r/webs/cache" + "humungus.tedunangst.com/r/webs/gencache" "humungus.tedunangst.com/r/webs/httpsig" "humungus.tedunangst.com/r/webs/junk" "humungus.tedunangst.com/r/webs/login"@@ -88,6 +89,9 @@ templinfo["LocalJSParam"] = getassetparam(dataDir + "/views/local.js")
templinfo["ServerName"] = serverName templinfo["IconName"] = iconName templinfo["UserSep"] = userSep + if r == nil { + return templinfo + } if u := login.GetUserInfo(r); u != nil { templinfo["UserInfo"], _ = butwhatabout(u.Username) templinfo["UserStyle"] = getuserstyle(u)@@ -98,9 +102,50 @@ }
return templinfo } +var oldnews = gencache.New(gencache.Options[string, []byte]{ + Fill: func(url string) ([]byte, bool) { + templinfo := getInfo(nil) + var honks []*Honk + var userid int64 = -1 + + templinfo["ServerMessage"] = serverMsg + switch url { + case "/events": + honks = geteventhonks(userid) + templinfo["ServerMessage"] = "some recent and upcoming events" + default: + templinfo["ShowRSS"] = true + honks = getpublichonks() + } + reverbolate(userid, honks) + templinfo["Honks"] = honks + templinfo["MapLink"] = getmaplink(nil) + var buf bytes.Buffer + err := readviews.Execute(&buf, "honkpage.html", templinfo) + if err != nil { + elog.Print(err) + } + return buf.Bytes(), true + + }, + Duration: 1 * time.Minute, +}) + +func lonelypage(w http.ResponseWriter, r *http.Request) { + page, _ := oldnews.Get(r.URL.Path) + if !develMode { + w.Header().Set("Cache-Control", "max-age=60") + } + w.Write(page) +} + func homepage(w http.ResponseWriter, r *http.Request) { + u := login.GetUserInfo(r) + if u == nil { + lonelypage(w, r) + return + } templinfo := getInfo(r) - u := login.GetUserInfo(r) var honks []*Honk var userid int64 = -1@@ -1199,10 +1244,10 @@ rawhonks := gethonksbyconvoy(honk.UserID, honk.Convoy, 0)
//reversehonks(rawhonks) rawhonks = threadsort(rawhonks) var honks []*Honk - for _, h := range rawhonks { + for i, h := range rawhonks { if h.XID == xid { templinfo["Honkology"] = honkology(h) - if len(honks) != 0 { + if i > 0 { h.Style += " glow" } }