bluesky appview implementation using microcosm and other services server.reddwarf.app
appview bluesky reddwarf microcosm

getProfiles

Changed files
+42 -4
auth
shims
lex
app
bsky
actor
+1 -1
auth/auth.go
··· 200 200 } 201 201 202 202 if claims.Audience != auth.ServiceDID { 203 - c.JSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Invalid audience (expected %s)", auth.ServiceDID)}) 203 + c.JSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Invalid audience (found '%s', expected '%s')", claims.Audience, auth.ServiceDID)}) 204 204 c.Abort() 205 205 return 206 206 }
+40 -2
main.go
··· 21 21 22 22 // "github.com/bluesky-social/indigo/atproto/atclient" 23 23 // comatproto "github.com/bluesky-social/indigo/api/atproto" 24 - // appbsky "github.com/bluesky-social/indigo/api/bsky" 24 + appbsky "github.com/bluesky-social/indigo/api/bsky" 25 25 // "github.com/bluesky-social/indigo/atproto/atclient" 26 26 // "github.com/bluesky-social/indigo/atproto/identity" 27 27 // "github.com/bluesky-social/indigo/atproto/syntax" ··· 84 84 100_000, 85 85 time.Hour*12, 86 86 5, 87 - serviceWebDID+"#bsky_appview", 87 + serviceWebDID, //+"#bsky_appview", 88 88 ) 89 89 if err != nil { 90 90 log.Fatalf("Failed to create Auth: %v", err) ··· 160 160 panic(err) 161 161 } 162 162 fmt.Println(string(data)) 163 + 164 + router.GET("/xrpc/app.bsky.actor.getProfiles", 165 + func(c *gin.Context) { 166 + actors := c.QueryArray("actors") 167 + 168 + profiles := make([]*appbsky.ActorDefs_ProfileViewDetailed, 0, len(actors)) 169 + 170 + for _, v := range actors { 171 + did, err := utils.NewDID(v) 172 + if err != nil { 173 + continue 174 + } 175 + profile, _, _ := appbskyactordefs.ProfileViewDetailed(ctx, did, sl, cs, BSKYIMAGECDN_URL) 176 + profiles = append(profiles, profile) 177 + } 178 + 179 + c.JSON(http.StatusOK, &appbsky.ActorGetProfiles_Output{ 180 + Profiles: profiles, 181 + }) 182 + }) 183 + 184 + router.GET("/xrpc/app.bsky.actor.getProfile", 185 + func(c *gin.Context) { 186 + actor := c.Query("actor") 187 + did, err := utils.NewDID(actor) 188 + if err != nil { 189 + c.JSON(http.StatusBadRequest, nil) 190 + return 191 + } 192 + profile, _, _ := appbskyactordefs.ProfileViewDetailed(ctx, did, sl, cs, BSKYIMAGECDN_URL) 193 + c.JSON(http.StatusOK, profile) 194 + }) 195 + 196 + // really bad actually 197 + router.GET("/xrpc/app.bsky.notification.listNotifications", 198 + func(c *gin.Context) { 199 + c.JSON(http.StatusOK, nil) 200 + }) 163 201 164 202 router.GET("/", func(c *gin.Context) { 165 203 log.Println("hello worldio !")
+1 -1
shims/lex/app/bsky/actor/defs/profileview.go
··· 94 94 } 95 95 followerCount := int64(followerCount_Out.Total) 96 96 97 - banner := utils.MakeImageCDN(did, imgcdn, "banner", profile.Avatar.Ref.String()) 97 + banner := utils.MakeImageCDN(did, imgcdn, "banner", profile.Banner.Ref.String()) 98 98 99 99 nilCount := int64(-1) 100 100