tiny 88x31 lexicon for atproto

add limit and doc

+18 -1
+18 -1
handler/handler.go
··· 189 189 "https://88x31.store/embed/liked-by?handle=moth11.net", 190 190 }, 191 191 { 192 + "limit=", 193 + "integer as string", 194 + "min=1, max=100, fetches up to limit liked buttons reverse chronologically", 195 + "https://88x31.store/embed/liked-by?did=did:plc:25z6ogppprfvijcnqo2fsfce&limit=2", 196 + }, 197 + { 192 198 "attribute=", 193 199 "non-empty string", 194 200 "any non-empty string for attribute will add a line at the bottom of the generated html linking to 88x31.store. no worries if you prefer the plain look!", ··· 214 220 did = id.DID.String() 215 221 } 216 222 } 223 + } 224 + limit := q.Get("limit") 225 + lint, err := strconv.Atoi(limit) 226 + if err != nil { 227 + lint = 50 228 + } 229 + if lint < 1 { 230 + lint = 1 231 + } 232 + if lint > 100 { 233 + lint = 100 217 234 } 218 235 cursor := q.Get("cursor") 219 236 var crsr *string ··· 261 278 default: 262 279 imageRendering = "pixelated" 263 280 } 264 - btns, ncrsr, err := h.db.GetUserLikes(did, 50, crsr, r.Context()) 281 + btns, ncrsr, err := h.db.GetUserLikes(did, lint, crsr, r.Context()) 265 282 if err != nil { 266 283 log.Println(err) 267 284 http.Error(w, "error", http.StatusInternalServerError)