Something went wrong. Try again.
A fork of the Cocoon PDS but being made more distributed. forked from willdot.net/cocoon
Something went wrong. Try again.
669 B · 36 lines
Go
at test
12345678910111213141516171819202122232425262728293031323334353637package server
import ( "github.com/haileyok/cocoon/internal/helpers" "github.com/ipfs/go-cid" "github.com/labstack/echo/v4")
type ComAtprotoSyncGetLatestCommitResponse struct { Cid string `json:"string"` Rev string `json:"rev"`}
func (s *Server) handleSyncGetLatestCommit(e echo.Context) error { ctx := e.Request().Context()
did := e.QueryParam("did") if did == "" { return helpers.InputError(e, nil) }
urepo, err := s.getRepoActorByDid(ctx, did) if err != nil { return err }
c, err := cid.Cast(urepo.Root) if err != nil { return err }
return e.JSON(200, ComAtprotoSyncGetLatestCommitResponse{ Cid: c.String(), Rev: urepo.Rev, })}