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

sad

Changed files
+16 -12
+16 -12
main.go
··· 73 73 // spacedust is type definitions only 74 74 // jetstream types is probably available from jetstream/pkg/models 75 75 76 - router := gin.Default() 76 + router := gin.New() 77 + router.Use(gin.Logger()) 78 + router.Use(gin.Recovery()) 79 + router.Use(cors.Default()) 77 80 78 81 router.GET("/.well-known/did.json", GetWellKnownDID) 79 82 ··· 81 84 100_000, 82 85 time.Hour*12, 83 86 5, 84 - serviceWebDID, 87 + serviceWebDID+"#bsky_appview", 85 88 ) 86 89 if err != nil { 87 90 log.Fatalf("Failed to create Auth: %v", err) 88 91 } 89 92 90 93 router.Use(auther.AuthenticateGinRequestViaJWT) 91 - router.Use(cors.New(cors.Config{ 92 - AllowAllOrigins: true, 93 - AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}, 94 - AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"}, 95 - ExposeHeaders: []string{"Content-Length"}, 96 - AllowCredentials: true, 97 - MaxAge: 12 * 3600, 98 - })) 99 94 100 95 responsewow, err := agnostic.RepoGetRecord(ctx, sl, "", "app.bsky.actor.profile", "did:web:did12.whey.party", "self") 101 96 if err != nil { ··· 122 117 123 118 kv := store.NewKV() 124 119 120 + // sad attempt to get putpref working. tldr it wont work without a client fork 121 + // https://bsky.app/profile/did:web:did12.whey.party/post/3m75xtomd722n 122 + router.GET("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) { 123 + c.Status(200) 124 + }) 125 125 router.PUT("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) { 126 + c.Status(200) 127 + }) 128 + router.POST("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) { 129 + c.Status(200) 130 + 126 131 userDID := c.GetString("user_did") 127 132 body, err := io.ReadAll(c.Request.Body) 128 133 if err != nil { ··· 131 136 } 132 137 133 138 kv.Set(userDID, body) 134 - c.Status(200) 135 139 136 140 }) 137 141 ··· 211 215 log.Println(fmt.Errorf("error parsing serviceDID: %w", err)) 212 216 return 213 217 } 214 - serviceID, err := did.ParseDID("#bsky_fg") 218 + serviceID, err := did.ParseDID("#bsky_appview") 215 219 if err != nil { 216 220 panic(err) 217 221 }