tiny 88x31 lexicon for atproto

lol

+17 -18
-18
handler/button.go
··· 2 2 3 3 import ( 4 4 "encoding/json" 5 - "github.com/bluesky-social/indigo/atproto/identity" 6 - "github.com/bluesky-social/indigo/atproto/syntax" 7 5 "log" 8 6 "net/http" 9 7 "strconv" ··· 60 58 61 59 func (h *Handler) getLikedButtons(w http.ResponseWriter, r *http.Request) { 62 60 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 - log.Println(did) 72 - } else { 73 - log.Println(err.Error()) 74 - } 75 - } else { 76 - log.Println(err.Error()) 77 - } 78 - } 79 61 80 62 limita := r.URL.Query().Get("limit") 81 63 limit, err := strconv.Atoi(limita)
+17
handler/handler.go
··· 3 3 import ( 4 4 "fmt" 5 5 "github.com/bluesky-social/indigo/atproto/auth/oauth" 6 + "github.com/bluesky-social/indigo/atproto/identity" 7 + "github.com/bluesky-social/indigo/atproto/syntax" 6 8 "github.com/gorilla/sessions" 7 9 "html/template" 8 10 "log" ··· 261 263 func (h *Handler) getuserlikes(w http.ResponseWriter, r *http.Request) { 262 264 q := r.URL.Query() 263 265 did := q.Get("did") 266 + handle := r.URL.Query().Get("handle") 267 + if did == "" && handle != "" { 268 + h, err := syntax.ParseHandle(handle) 269 + if err == nil { 270 + id, err := identity.DefaultDirectory().LookupHandle(r.Context(), h) 271 + if err == nil { 272 + did = id.DID.String() 273 + log.Println(did) 274 + } else { 275 + log.Println(err.Error()) 276 + } 277 + } else { 278 + log.Println(err.Error()) 279 + } 280 + } 264 281 bg := q.Get("bg") 265 282 if len(bg) == 6 { 266 283 bg = fmt.Sprintf("#%s", bg)