all repos — honk @ 891c8562c955782e663693f1de3d802a0d7ce758

my fork of honk

also export the inbox
Ted Unangst tedu@tedunangst.com
Fri, 18 Aug 2023 14:32:27 -0400
commit

891c8562c955782e663693f1de3d802a0d7ce758

parent

872643426e479fc756020f0d8a60bfcd5cf7d337

2 files changed, 26 insertions(+), 2 deletions(-)

jump to
M database.godatabase.go

@@ -245,7 +245,7 @@ }

func gethonksforme(userid int64, wanted int64) []*Honk { dt := time.Now().Add(-7 * 24 * time.Hour).UTC().Format(dbtimeformat) - rows, err := stmtHonksForMe.Query(wanted, userid, dt, userid) + rows, err := stmtHonksForMe.Query(wanted, userid, dt, userid, 250) return getsomehonks(rows, err) } func gethonksfromlongago(userid int64, wanted int64) []*Honk {

@@ -1184,7 +1184,7 @@ stmtUserHonks = preparetodie(db, selecthonks+"where honks.honkid > ? and (whofore = 2 or whofore = ?) and username = ? and dt > ?"+smalllimit)

myhonkers := " and honker in (select xid from honkers where userid = ? and (flavor = 'sub' or flavor = 'peep' or flavor = 'presub') and combos not like '% - %')" stmtHonksForUser = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ?"+myhonkers+butnotthose+limit) stmtHonksForUserFirstClass = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and (rid = '' or what = 'bonk')"+myhonkers+butnotthose+limit) - stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+limit) + stmtHonksForMe = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and whofore = 1"+butnotthose+smalllimit) stmtHonksFromLongAgo = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and dt > ? and dt < ? and whofore = 2"+butnotthose+limit) stmtHonksISaved = preparetodie(db, selecthonks+"where honks.honkid > ? and honks.userid = ? and flags & 4 order by honks.honkid desc") stmtHonksByHonker = preparetodie(db, selecthonks+"join honkers on (honkers.xid = honks.honker or honkers.xid = honks.oonker) where honks.honkid > ? and honks.userid = ? and honkers.name = ?"+butnotthose+limit)
M import.goimport.go

@@ -556,6 +556,30 @@ j["totalItems"] = len(jonks)

j["orderedItems"] = jonks j.Write(w) } + { + w, err := zd.Create("inbox.json") + if err != nil { + elog.Fatal(err) + } + var jonks []junk.Junk + rows, err := stmtHonksForMe.Query(0, user.ID, "0", user.ID, 1234567) + honks := getsomehonks(rows, err) + for _, honk := range honks { + j, _ := jonkjonk(user, honk) + for _, donk := range honk.Donks { + donks[donk.XID] = true + } + jonks = append(jonks, j) + } + j := junk.New() + j["@context"] = itiswhatitis + j["id"] = user.URL + "/inbox" + j["attributedTo"] = user.URL + j["type"] = "OrderedCollection" + j["totalItems"] = len(jonks) + j["orderedItems"] = jonks + j.Write(w) + } zd.Create("media/") for donk := range donks { var media string