An atproto PDS written in Go

Reapply "support multiple cids in getblocks (#23)"

This reverts commit 125b864f150200359af56f4abe77385dc9d0227f.

Changed files
+7 -6
server
+7 -6
server/handle_sync_get_blocks.go
···
import (
"bytes"
-
"context"
-
"strings"
"github.com/bluesky-social/indigo/carstore"
"github.com/haileyok/cocoon/internal/helpers"
···
)
func (s *Server) handleGetBlocks(e echo.Context) error {
+
ctx := e.Request().Context()
did := e.QueryParam("did")
-
cidsstr := e.QueryParam("cids")
if did == "" {
return helpers.InputError(e, nil)
}
-
cidstrs := strings.Split(cidsstr, ",")
-
cids := []cid.Cid{}
+
cidstrs, ok := e.QueryParams()["cids"]
+
if !ok {
+
return helpers.InputError(e, nil)
+
}
+
var cids []cid.Cid
for _, cs := range cidstrs {
c, err := cid.Cast([]byte(cs))
···
bs := s.getBlockstore(urepo.Repo.Did)
for _, c := range cids {
-
b, err := bs.Get(context.TODO(), c)
+
b, err := bs.Get(ctx, c)
if err != nil {
return err
}