tiny 88x31 lexicon for atproto

add handle fragment

+22 -1
+14
handler/button.go
··· 2 3 import ( 4 "encoding/json" 5 "log" 6 "net/http" 7 "strconv" ··· 58 59 func (h *Handler) getLikedButtons(w http.ResponseWriter, r *http.Request) { 60 did := r.URL.Query().Get("did") 61 limita := r.URL.Query().Get("limit") 62 limit, err := strconv.Atoi(limita) 63 if err != nil {
··· 2 3 import ( 4 "encoding/json" 5 + "github.com/bluesky-social/indigo/atproto/identity" 6 + "github.com/bluesky-social/indigo/atproto/syntax" 7 "log" 8 "net/http" 9 "strconv" ··· 60 61 func (h *Handler) getLikedButtons(w http.ResponseWriter, r *http.Request) { 62 did := r.URL.Query().Get("did") 63 + handle := r.URL.Query().Get("handle") 64 + 65 + if did == "" && handle != "" { 66 + h, err := syntax.ParseHandle(handle) 67 + if err == nil { 68 + id, err := identity.DefaultDirectory().LookupHandle(r.Context(), h) 69 + if err == nil { 70 + did = id.DID.String() 71 + } 72 + } 73 + } 74 + 75 limita := r.URL.Query().Get("limit") 76 limit, err := strconv.Atoi(limita) 77 if err != nil {
+8 -1
handler/handler.go
··· 175 } 176 rd.Title = "reference" 177 rd.Docs = []Apidoc{ 178 - {"did=", 179 "atproto did as string", 180 "prefer to use atproto did! i don't locally store handle:did mappings, so if you use a handle, i have to resolve it on the fly, which adds latency", 181 "https://88x31.store/embed/liked-by?did=did:plc:25z6ogppprfvijcnqo2fsfce", 182 }, 183 } 184
··· 175 } 176 rd.Title = "reference" 177 rd.Docs = []Apidoc{ 178 + { 179 + "did=", 180 "atproto did as string", 181 "prefer to use atproto did! i don't locally store handle:did mappings, so if you use a handle, i have to resolve it on the fly, which adds latency", 182 "https://88x31.store/embed/liked-by?did=did:plc:25z6ogppprfvijcnqo2fsfce", 183 + }, 184 + { 185 + "handle=", 186 + "atproto handle as string", 187 + "prefer to use atproto did! i don't locally store handle:did mappings, so if you use a handle, i have to resolve it on the fly, which adds latency", 188 + "https://88x31.store/embed/liked-by?handle=moth11.net", 189 }, 190 } 191