nandi/gleanpublic Fork 0
0438036
Commits
Clone
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Fetch and cache missing profile details on demandUnverified

Julien Robert committed 2026-04-22T14:10:03+02:00 Browse files
0438036 parent: c898429
modified internal/server/profile_handler.go +9 -0
@@ -35,6 +35,15 @@ func (s *Server) handleProfile(w http.ResponseWriter, r *http.Request) {
3535 return
3636 }
3737
38+ if !profileUser.AvatarURL.Valid || profileUser.AvatarURL.String == "" {
39+ _, displayName, avatarURL, err := atproto.FetchProfile(r.Context(), did)
40+ if err == nil && avatarURL != "" {
41+ _ = s.db.UpdateUserProfile(r.Context(), did, displayName, avatarURL)
42+ profileUser.DisplayName = nullString(displayName)
43+ profileUser.AvatarURL = nullString(avatarURL)
44+ }
45+ }
46+
3847 subs, _ := s.db.ListSubscriptions(r.Context(), did, "", 50, 0)
3948 annotations, _ := s.db.ListAnnotations(r.Context(), "", "", did, 50, 0)
4049 subCount, _ := s.db.GetSubscriptionCount(r.Context(), did)
@@ -35,6 +35,15 @@ func (s *Server) handleProfile(w http.ResponseWriter, r *http.Request) {
35 return35 return
36 }36 }
37 37
38+ if !profileUser.AvatarURL.Valid || profileUser.AvatarURL.String == "" {
39+ _, displayName, avatarURL, err := atproto.FetchProfile(r.Context(), did)
40+ if err == nil && avatarURL != "" {
41+ _ = s.db.UpdateUserProfile(r.Context(), did, displayName, avatarURL)
42+ profileUser.DisplayName = nullString(displayName)
43+ profileUser.AvatarURL = nullString(avatarURL)
44+ }
45+ }
46+
38 subs, _ := s.db.ListSubscriptions(r.Context(), did, "", 50, 0)47 subs, _ := s.db.ListSubscriptions(r.Context(), did, "", 50, 0)
39 annotations, _ := s.db.ListAnnotations(r.Context(), "", "", did, 50, 0)48 annotations, _ := s.db.ListAnnotations(r.Context(), "", "", did, 50, 0)
40 subCount, _ := s.db.GetSubscriptionCount(r.Context(), did)49 subCount, _ := s.db.GetSubscriptionCount(r.Context(), did)