Monorepo for Tangled tangled.org

appview: fix pfp fetching

Thanks to @ducky.ws, this changes GetAvatarUri to fetch it directly from the PDS.

Tangled ca03e4fe 5d57f0ab

Changed files
+4 -4
appview
state
+4 -4
appview/state/state.go
··· 764 764 followStatus = db.GetFollowStatus(s.db, loggedInUser.Did, ident.DID.String()) 765 765 } 766 766 767 - profileAvatarUri, err := GetAvatarUri(ident.DID.String()) 767 + profileAvatarUri, err := GetAvatarUri(ident.DID.String(), ident.PDSEndpoint()) 768 768 if err != nil { 769 769 log.Println("failed to fetch bsky avatar", err) 770 770 } ··· 785 785 }) 786 786 } 787 787 788 - func GetAvatarUri(did string) (string, error) { 789 - recordURL := fmt.Sprintf("https://bsky.social/xrpc/com.atproto.repo.getRecord?repo=%s&collection=app.bsky.actor.profile&rkey=self", did) 788 + func GetAvatarUri(did string, pds string) (string, error) { 789 + recordURL := fmt.Sprintf("%s/xrpc/com.atproto.repo.getRecord?repo=%s&collection=app.bsky.actor.profile&rkey=self", pds, did) 790 790 791 791 recordResp, err := http.Get(recordURL) 792 792 if err != nil { ··· 827 827 return "", fmt.Errorf("no link found for handle %s", did) 828 828 } 829 829 830 - return fmt.Sprintf("https://cdn.bsky.app/img/feed_thumbnail/plain/%s/%s", did, link), nil 830 + return fmt.Sprintf("%s/xrpc/com.atproto.sync.getBlob?did=%s&cid=%s", pds, did, link), nil 831 831 }