A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
76
fork

Configure Feed

Select the types of activity you want to include in your feed.

placeholder profile for when sailor profile is not found

evan.jarrett.net 111cc4cc cefe0038

verified
+23 -9
+15 -7
pkg/appview/handlers/user.go
··· 21 21 identifier := chi.URLParam(r, "handle") 22 22 23 23 // Resolve identifier (handle or DID) to canonical DID and current handle 24 - did, resolvedHandle, _, err := atproto.ResolveIdentity(r.Context(), identifier) 24 + did, resolvedHandle, pdsEndpoint, err := atproto.ResolveIdentity(r.Context(), identifier) 25 25 if err != nil { 26 26 http.Error(w, "User not found", http.StatusNotFound) 27 27 return ··· 33 33 http.Error(w, err.Error(), http.StatusInternalServerError) 34 34 return 35 35 } 36 - if viewedUser == nil { 37 - http.Error(w, "User not found", http.StatusNotFound) 38 - return 39 - } 40 36 41 - // Opportunistically update cached handle if it changed 42 - if viewedUser.Handle != resolvedHandle { 37 + hasProfile := true 38 + if viewedUser == nil { 39 + // Valid ATProto user but hasn't set up ATCR profile 40 + hasProfile = false 41 + viewedUser = &db.User{ 42 + DID: did, 43 + Handle: resolvedHandle, 44 + PDSEndpoint: pdsEndpoint, 45 + // Avatar intentionally empty - template shows '?' placeholder 46 + } 47 + } else if viewedUser.Handle != resolvedHandle { 48 + // Opportunistically update cached handle if it changed 43 49 _ = db.UpdateUserHandle(h.DB, did, resolvedHandle) 44 50 viewedUser.Handle = resolvedHandle 45 51 } ··· 77 83 PageData 78 84 ViewedUser *db.User // User whose page we're viewing 79 85 Repositories []db.RepoCardData 86 + HasProfile bool 80 87 }{ 81 88 PageData: NewPageData(r, h.RegistryURL), 82 89 ViewedUser: viewedUser, 83 90 Repositories: cards, 91 + HasProfile: hasProfile, 84 92 } 85 93 86 94 if err := h.Templates.ExecuteTemplate(w, "user", data); err != nil {
+8 -2
pkg/appview/templates/pages/user.html
··· 13 13 <div class="user-profile"> 14 14 {{ if .ViewedUser.Avatar }} 15 15 <img src="{{ .ViewedUser.Avatar }}" alt="{{ .ViewedUser.Handle }}" class="profile-avatar"> 16 - {{ else }} 16 + {{ else if .HasProfile }} 17 17 <div class="profile-avatar-placeholder">{{ firstChar .ViewedUser.Handle }}</div> 18 + {{ else }} 19 + <div class="profile-avatar-placeholder">?</div> 18 20 {{ end }} 19 21 <h1>{{ .ViewedUser.Handle }}</h1> 20 22 </div> 21 23 22 - {{ if .Repositories }} 24 + {{ if not .HasProfile }} 25 + <div class="empty-state"> 26 + <p>This user hasn't set up their ATCR profile yet.</p> 27 + </div> 28 + {{ else if .Repositories }} 23 29 <div class="featured-grid"> 24 30 {{ range .Repositories }} 25 31 {{ template "repo-card" . }}