A fork of the Cocoon PDS but being made more distributed.
11

Configure Feed

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

hack results fix

Hailey (Mar 29, 2025, 6:32 PM -0700) 2269c30e 94f265b7

+20 -12
+20 -12
server/repo.go
··· 106 106 r, err := repo.OpenRepo(context.TODO(), dbs, rootcid) 107 107 108 108 entries := []models.Record{} 109 + var results []ApplyWriteResult 109 110 110 111 for i, op := range writes { 111 112 if op.Type != OpTypeCreate && op.Rkey == nil { ··· 136 137 Cid: nc.String(), 137 138 Value: d, 138 139 }) 140 + results = append(results, ApplyWriteResult{ 141 + Type: OpTypeCreate.String(), 142 + Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey, 143 + Cid: nc.String(), 144 + ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol 145 + }) 139 146 case OpTypeDelete: 140 147 err := r.DeleteRecord(context.TODO(), op.Collection+"/"+*op.Rkey) 141 148 if err != nil { ··· 156 163 Cid: nc.String(), 157 164 Value: d, 158 165 }) 166 + results = append(results, ApplyWriteResult{ 167 + Type: OpTypeUpdate.String(), 168 + Uri: "at://" + urepo.Did + "/" + op.Collection + "/" + *op.Rkey, 169 + Cid: nc.String(), 170 + ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol 171 + }) 159 172 } 160 173 } 161 174 ··· 221 234 } 222 235 } 223 236 224 - var results []ApplyWriteResult 225 - 226 237 var blobs []lexutil.LexLink 227 238 for _, entry := range entries { 228 239 if err := rm.s.db.Clauses(clause.OnConflict{ ··· 241 252 for _, c := range cids { 242 253 blobs = append(blobs, lexutil.LexLink(c)) 243 254 } 244 - 245 - results = append(results, ApplyWriteResult{ 246 - Uri: "at://" + urepo.Did + "/" + entry.Nsid + "/" + entry.Rkey, 247 - Cid: entry.Cid, 248 - Commit: &RepoCommit{ 249 - Cid: newroot.String(), 250 - Rev: rev, 251 - }, 252 - ValidationStatus: to.StringPtr("valid"), // TODO: obviously this might not be true atm lol 253 - }) 254 255 } 255 256 256 257 rm.s.evtman.AddEvent(context.TODO(), &events.XRPCStreamEvent{ ··· 269 270 270 271 if err := dbs.UpdateRepo(context.TODO(), newroot, rev); err != nil { 271 272 return nil, err 273 + } 274 + 275 + for i := range results { 276 + results[i].Commit = &RepoCommit{ 277 + Cid: newroot.String(), 278 + Rev: rev, 279 + } 272 280 } 273 281 274 282 return results, nil