A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
81
fork

Configure Feed

Select the types of activity you want to include in your feed.

implement HandleGetLatestCommit

+39
+6
pkg/atproto/endpoints.go
··· 135 135 // Response: {"did": "...", "active": true, "rev": "..."} 136 136 SyncGetRepoStatus = "/xrpc/com.atproto.sync.getRepoStatus" 137 137 138 + // SyncGetLatestCommit gets the current commit CID and revision for a repository. 139 + // Method: GET 140 + // Query: did={did} 141 + // Response: {"cid": "...", "rev": "..."} 142 + SyncGetLatestCommit = "/xrpc/com.atproto.sync.getLatestCommit" 143 + 138 144 // SyncGetHostStatus gets the hosting/crawl status for a hostname on a relay. 139 145 // Method: GET 140 146 // Query: hostname={hostname}
+33
pkg/hold/pds/xrpc.go
··· 169 169 r.Get(atproto.SyncGetRecord, h.HandleSyncGetRecord) 170 170 r.Get(atproto.SyncGetRepo, h.HandleGetRepo) 171 171 r.Get(atproto.SyncGetRepoStatus, h.HandleGetRepoStatus) 172 + r.Get(atproto.SyncGetLatestCommit, h.HandleGetLatestCommit) 172 173 r.Get(atproto.SyncSubscribeRepos, h.HandleSubscribeRepos) 173 174 174 175 // DID document and handle resolution ··· 1291 1292 "did": did, 1292 1293 "active": true, 1293 1294 "rev": rev, 1295 + }) 1296 + } 1297 + 1298 + // HandleGetLatestCommit returns the current commit CID and revision for a repository. 1299 + // Spec: https://docs.bsky.app/docs/api/com-atproto-sync-get-latest-commit 1300 + func (h *XRPCHandler) HandleGetLatestCommit(w http.ResponseWriter, r *http.Request) { 1301 + did := r.URL.Query().Get("did") 1302 + if did == "" { 1303 + http.Error(w, "missing required parameter: did", http.StatusBadRequest) 1304 + return 1305 + } 1306 + 1307 + if did != h.pds.DID() { 1308 + http.Error(w, "RepoNotFound", http.StatusNotFound) 1309 + return 1310 + } 1311 + 1312 + head, err := h.pds.repomgr.GetRepoRoot(r.Context(), h.pds.uid) 1313 + if err != nil { 1314 + http.Error(w, "RepoNotFound", http.StatusNotFound) 1315 + return 1316 + } 1317 + 1318 + rev, err := h.pds.repomgr.GetRepoRev(r.Context(), h.pds.uid) 1319 + if err != nil || rev == "" { 1320 + http.Error(w, "RepoNotFound", http.StatusNotFound) 1321 + return 1322 + } 1323 + 1324 + render.JSON(w, r, map[string]any{ 1325 + "cid": head.String(), 1326 + "rev": rev, 1294 1327 }) 1295 1328 } 1296 1329