rename some zonk stuff
Ted Unangst tedu@tedunangst.com
Sun, 23 Jun 2019 22:21:59 -0400
7 files changed,
27 insertions(+),
23 deletions(-)
M
docs/manual.txt
→
docs/manual.txt
@@ -53,7 +53,7 @@ those of others that you're tired of seeing. Be advised that deletion
works poorly in a federated environment. It's more like please disregard. The zonkzone supports muting unwanted contacts. One may mute an actor -(zonker), a domain (zurl), thread (zonvoy), or word (zword). +(zonker), a domain (zomain), thread (zonvoy), or word (zord). -- privacy
M
docs/spec.txt
→
docs/spec.txt
@@ -62,7 +62,7 @@ The xonkers table stores info about external accounts that we may interact
with. Their keys, their inboxes, etc. Not user visible. The zonkers table stores things we do not wish to see, per the wherefore -column. zonkers are bad people, zurls are bad hosts, zonvoys are bad threads. +column. Also used for tombstones for deleted honks to prevent refetching. The xid column generally corresponds to ActivityPub id.
M
fun.go
→
fun.go
@@ -54,7 +54,7 @@ }
zap := make(map[*Donk]bool) h.Noise = unpucker(h.Noise) precis := h.Precis - if strings.HasPrefix(h.Noise, "<p>" + precis) { + if strings.HasPrefix(h.Noise, "<p>"+precis) { precis = "" } if precis != "" {@@ -86,11 +86,11 @@ }
} func osmosis(honks []*Honk, userid int64) []*Honk { - zwords := getzwords(userid) + zords := getzords(userid) j := 0 outer: for _, h := range honks { - for _, z := range zwords { + for _, z := range zords { if z.MatchString(h.Precis) || z.MatchString(h.Noise) { continue outer }@@ -469,7 +469,7 @@ return zag(r, payload)
} var thumbbiters map[int64]map[string]bool -var zwordses map[int64][]*regexp.Regexp +var zordses map[int64][]*regexp.Regexp var thumblock sync.Mutex func bitethethumbs() {@@ -483,7 +483,7 @@
thumblock.Lock() defer thumblock.Unlock() thumbbiters = make(map[int64]map[string]bool) - zwordses = make(map[int64][]*regexp.Regexp) + zordses = make(map[int64][]*regexp.Regexp) for rows.Next() { var userid int64 var name, wherefore string@@ -492,13 +492,13 @@ if err != nil {
log.Printf("error scanning zonker: %s", err) continue } - if wherefore == "zword" { - zword := "\\b(?i:" + name + ")\\b" - re, err := regexp.Compile(zword) + if wherefore == "zord" { + zord := "\\b(?i:" + name + ")\\b" + re, err := regexp.Compile(zord) if err != nil { - log.Printf("error compiling zword: %s", err) + log.Printf("error compiling zord: %s", err) } else { - zwordses[userid] = append(zwordses[userid], re) + zordses[userid] = append(zordses[userid], re) } continue }@@ -511,10 +511,10 @@ m[name] = true
} } -func getzwords(userid int64) []*regexp.Regexp { +func getzords(userid int64) []*regexp.Regexp { thumblock.Lock() defer thumblock.Unlock() - return zwordses[userid] + return zordses[userid] } func thoudostbitethythumb(userid int64, who []string, objid string) bool {
M
honk.go
→
honk.go
@@ -1178,16 +1178,16 @@ return
} switch wherefore { case "zonker": - case "zurl": + case "zomain": case "zonvoy": - case "zword": + case "zord": default: return } db := opendatabase() db.Exec("insert into zonkers (userid, name, wherefore) values (?, ?, ?)", userinfo.UserID, name, wherefore) - if wherefore == "zonker" || wherefore == "zurl" || wherefore == "zword" { + if wherefore == "zonker" || wherefore == "zomain" || wherefore == "zord" { bitethethumbs() }@@ -1481,7 +1481,7 @@ stmtAddDoover = preparetodie(db, "insert into doovers (dt, tries, username, rcpt, msg) values (?, ?, ?, ?, ?)")
stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers") stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?") stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?") - stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl' or wherefore = 'zword')") + stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zomain' or wherefore = 'zord')") stmtFindZonk = preparetodie(db, "select zonkerid from zonkers where userid = ? and name = ? and wherefore = 'zonk'") stmtGetZonkers = preparetodie(db, "select zonkerid, name, wherefore from zonkers where userid = ? and wherefore <> 'zonk'") stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)")
M
upgradedb.go
→
upgradedb.go
@@ -98,6 +98,10 @@ doordie(db, "create table xonkers (xonkerid integer primary key, name text, info text, flavor text)")
doordie(db, "create index idx_xonkername on xonkers(name)") doordie(db, "update config set value = 10 where key = 'dbversion'") case 10: + doordie(db, "update zonkers set wherefore = 'zomain' where wherefore = 'zurl'") + doordie(db, "update zonkers set wherefore = 'zord' where wherefore = 'zword'") + doordie(db, "update config set value = 11 where key = 'dbversion'") + case 11: default: log.Fatalf("can't upgrade unknown version %d", dbversion) }
M
views/zonkers.html
→
views/zonkers.html
@@ -11,14 +11,14 @@ <p>
<input type="radio" id="iszonker" name="wherefore" value="zonker"> <label for="iszonker">Zonker</label> <p> -<input type="radio" id="iszurl" name="wherefore" value="zurl"> -<label for="iszurl">Zurl</label> +<input type="radio" id="iszomain" name="wherefore" value="zomain"> +<label for="iszomain">Zomain</label> <p> <input type="radio" id="iszonvoy" name="wherefore" value="zonvoy"> <label for="iszonvoy">Zonvoy</label> <p> -<input type="radio" id="iszword" name="wherefore" value="zword"> -<label for="iszword">Zword</label> +<input type="radio" id="iszord" name="wherefore" value="zord"> +<label for="iszord">Zord</label> <p><br><input tabindex=1 type="submit" name="zonk" value="zonk!"> </form> </div>