donks for days. multiple images with api, adapted from benjojo

This commit is contained in:
Ted Unangst 2023-07-24 14:28:24 -04:00
parent b688f24e6d
commit c19490a802
1 changed files with 18 additions and 15 deletions

9
web.go
View File

@ -1801,8 +1801,9 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk {
donkxid = fmt.Sprintf("%s:%d", d.XID, d.FileID)
}
} else {
p := strings.Split(donkxid, ":")
xid := p[0]
for _, xid := range r.Form["donkxid"] {
p := strings.Split(xid, ":")
xid = p[0]
url := fmt.Sprintf("https://%s/d/%s", serverName, xid)
var donk *Donk
if len(p) > 1 {
@ -1817,6 +1818,7 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk {
ilog.Printf("can't find file: %s", xid)
}
}
}
memetize(honk)
imaginate(honk)
@ -2490,7 +2492,8 @@ func apihandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "missing donk", http.StatusBadRequest)
return
}
w.Write([]byte(d.XID))
donkxid := fmt.Sprintf("%s:%d", d.XID, d.FileID)
w.Write([]byte(donkxid))
case "zonkit":
zonkit(w, r)
case "gethonks":