this repo has no description

feat: add app.bsky.feed.describeFeedGenerator

Changed files
+27 -4
cmd
feedweb
+27 -4
cmd/feedweb/main.go
··· 5 5 "net/http" 6 6 7 7 appbsky "github.com/bluesky-social/indigo/api/bsky" 8 + "github.com/bluesky-social/indigo/atproto/syntax" 8 9 "github.com/edavis/bsky-feeds/pkg/feeds" 9 10 "github.com/edavis/bsky-feeds/pkg/mostliked" 10 11 "github.com/labstack/echo/v4" ··· 24 25 return t 25 26 } 26 27 28 + var generators = FeedLookup{ 29 + "at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/most-liked": mostliked.Feed, 30 + } 31 + 27 32 func getFeedSkeleton(c echo.Context) error { 28 33 var req SkeletonRequest 29 34 if err := c.Bind(&req); err != nil { 30 35 return c.String(http.StatusBadRequest, "bad request") 31 36 } 32 37 33 - generators := FeedLookup{ 34 - "at://did:plc:4nsduwlpivpuur4mqkbfvm6a/app.bsky.feed.generator/most-liked": mostliked.Feed, 35 - } 36 - 37 38 params := feeds.FeedgenParams{ 38 39 Feed: req.Feed, 39 40 Limit: req.Limit, ··· 48 49 return c.JSON(http.StatusOK, feed) 49 50 } 50 51 52 + func describeFeedGenerator(c echo.Context) error { 53 + type gen struct { 54 + DID string `json:"did"` 55 + Feeds []syntax.ATURI `json:"feeds"` 56 + } 57 + 58 + out := gen{ 59 + DID: `https://` + NgrokHostname, 60 + } 61 + 62 + for feedUri, _ := range generators { 63 + aturi, err := syntax.ParseATURI(feedUri) 64 + if err != nil { 65 + continue 66 + } 67 + out.Feeds = append(out.Feeds, aturi) 68 + } 69 + 70 + return c.JSON(http.StatusOK, out) 71 + } 72 + 51 73 func main() { 52 74 e := echo.New() 53 75 e.Use(middleware.Logger()) 54 76 e.Use(middleware.Recover()) 55 77 e.GET("/.well-known/did.json", didDoc) 56 78 e.GET("/xrpc/app.bsky.feed.getFeedSkeleton", getFeedSkeleton) 79 + e.GET("/xrpc/app.bsky.feed.describeFeedGenerator", describeFeedGenerator) 57 80 e.Logger.Fatal(e.Start(":5000")) 58 81 }