all repos — honk @ d60c51960fa83b20ff4432cdaa5ff0c5a1110676

my fork of honk

fix stale pubkey deletion
Ted Unangst tedu@tedunangst.com
Tue, 25 Jun 2019 20:49:25 -0400
commit

d60c51960fa83b20ff4432cdaa5ff0c5a1110676

parent

0a11841547bf3658715595a6d3c0e94e0ec8bd37

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

jump to
M fun.gofun.go

@@ -455,8 +455,7 @@ return

} func makeitworksomehowwithoutregardforkeycontinuity(keyname string, r *http.Request, payload []byte) (string, error) { - db := opendatabase() - _, err := db.Exec("delete from xonkers where xid = ?", keyname) + _, err := stmtDeleteXonker.Exec(keyname, "pubkey") if err != nil { log.Printf("error deleting key: %s", err) }
M honk.gohonk.go

@@ -1485,7 +1485,7 @@ var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt

var stmtFindZonk, stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt var stmtHasHonker, stmtThumbBiters, stmtZonkIt, stmtZonkDonks, stmtSaveZonker *sql.Stmt -var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker *sql.Stmt +var stmtGetZonkers, stmtRecentHonkers, stmtGetXonker, stmtSaveXonker, stmtDeleteXonker *sql.Stmt func preparetodie(db *sql.DB, s string) *sql.Stmt { stmt, err := db.Prepare(s)

@@ -1536,6 +1536,7 @@ stmtGetZonkers = preparetodie(db, "select zonkerid, name, wherefore from zonkers where userid = ? and wherefore <> 'zonk'")

stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)") stmtGetXonker = preparetodie(db, "select info from xonkers where name = ? and flavor = ?") stmtSaveXonker = preparetodie(db, "insert into xonkers (name, info, flavor) values (?, ?, ?)") + stmtDeleteXonker = preparetodie(db, "delete from xonkers where name = ? and flavor = ?") stmtRecentHonkers = preparetodie(db, "select distinct(honker) from honks where userid = ? order by honkid desc limit 100") }