forked from tangled.org/core
Monorepo for Tangled — https://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
···
followStatus = db.GetFollowStatus(s.db, loggedInUser.Did, ident.DID.String())
}
-
profileAvatarUri, err := GetAvatarUri(ident.DID.String())
+
profileAvatarUri, err := GetAvatarUri(ident.DID.String(), ident.PDSEndpoint())
if err != nil {
log.Println("failed to fetch bsky avatar", err)
}
···
})
}
-
func GetAvatarUri(did string) (string, error) {
-
recordURL := fmt.Sprintf("https://bsky.social/xrpc/com.atproto.repo.getRecord?repo=%s&collection=app.bsky.actor.profile&rkey=self", did)
+
func GetAvatarUri(did string, pds string) (string, error) {
+
recordURL := fmt.Sprintf("%s/xrpc/com.atproto.repo.getRecord?repo=%s&collection=app.bsky.actor.profile&rkey=self", pds, did)
recordResp, err := http.Get(recordURL)
if err != nil {
···
return "", fmt.Errorf("no link found for handle %s", did)
}
-
return fmt.Sprintf("https://cdn.bsky.app/img/feed_thumbnail/plain/%s/%s", did, link), nil
+
return fmt.Sprintf("%s/xrpc/com.atproto.sync.getBlob?did=%s&cid=%s", pds, did, link), nil
}