diff --git a/docs/manual.txt b/docs/manual.txt index 0dda857..0361239 100644 --- a/docs/manual.txt +++ b/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 diff --git a/docs/spec.txt b/docs/spec.txt index 5736bbd..4eb1125 100644 --- a/docs/spec.txt +++ b/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. diff --git a/fun.go b/fun.go index defbef8..cd20788 100644 --- a/fun.go +++ b/fun.go @@ -54,7 +54,7 @@ func reverbolate(honks []*Honk) { zap := make(map[*Donk]bool) h.Noise = unpucker(h.Noise) precis := h.Precis - if strings.HasPrefix(h.Noise, "

" + precis) { + if strings.HasPrefix(h.Noise, "

"+precis) { precis = "" } if precis != "" { @@ -86,11 +86,11 @@ func reverbolate(honks []*Honk) { } 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 @@ func makeitworksomehowwithoutregardforkeycontinuity(keyname string, r *http.Requ } 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 @@ func bitethethumbs() { 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 @@ func bitethethumbs() { 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 @@ func bitethethumbs() { } } -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 { diff --git a/honk.go b/honk.go index 341d5f6..2b34242 100644 --- a/honk.go +++ b/honk.go @@ -1178,16 +1178,16 @@ func zonkzonk(w http.ResponseWriter, r *http.Request) { } 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 @@ func prepareStatements(db *sql.DB) { 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 (?, ?, ?)") diff --git a/upgradedb.go b/upgradedb.go index b238b59..d652448 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -98,6 +98,10 @@ func upgradedb() { 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) } diff --git a/util.go b/util.go index 23fb013..eaa00d2 100644 --- a/util.go +++ b/util.go @@ -71,7 +71,7 @@ var dbtimeformat = "2006-01-02 15:04:05" var alreadyopendb *sql.DB var dbname = "honk.db" var stmtConfig *sql.Stmt -var myVersion = 10 +var myVersion = 11 func initdb() { schema, err := ioutil.ReadFile("schema.sql") diff --git a/views/zonkers.html b/views/zonkers.html index cbef52d..26a9739 100644 --- a/views/zonkers.html +++ b/views/zonkers.html @@ -11,14 +11,14 @@

- - + +

- - + +