An atproto PDS written in Go
103
fork

Configure Feed

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

at 8c7f03f9c80e688fc25a64ab838c78d4e0ef56d2 48 lines 1.4 kB view raw
1package server 2 3import ( 4 "context" 5 "time" 6 7 "github.com/bluesky-social/indigo/api/atproto" 8 "github.com/bluesky-social/indigo/events" 9 "github.com/bluesky-social/indigo/util" 10 "github.com/haileyok/cocoon/internal/helpers" 11 "github.com/haileyok/cocoon/models" 12 "github.com/labstack/echo/v4" 13) 14 15type ComAtprotoServerActivateAccountRequest struct { 16 // NOTE: this implementation will not pay attention to this value 17 DeleteAfter time.Time `json:"deleteAfter"` 18} 19 20func (s *Server) handleServerActivateAccount(e echo.Context) error { 21 ctx := e.Request().Context() 22 logger := s.logger.With("name", "handleServerActivateAccount") 23 24 var req ComAtprotoServerDeactivateAccountRequest 25 if err := e.Bind(&req); err != nil { 26 logger.Error("error binding", "error", err) 27 return helpers.ServerError(e, nil) 28 } 29 30 urepo := e.Get("repo").(*models.RepoActor) 31 32 if err := s.db.Exec(ctx, "UPDATE repos SET deactivated = ? WHERE did = ?", nil, false, urepo.Repo.Did).Error; err != nil { 33 logger.Error("error updating account status to deactivated", "error", err) 34 return helpers.ServerError(e, nil) 35 } 36 37 s.evtman.AddEvent(context.TODO(), &events.XRPCStreamEvent{ 38 RepoAccount: &atproto.SyncSubscribeRepos_Account{ 39 Active: true, 40 Did: urepo.Repo.Did, 41 Status: nil, 42 Seq: time.Now().UnixMicro(), // TODO: bad puppy 43 Time: time.Now().Format(util.ISO8601), 44 }, 45 }) 46 47 return e.NoContent(200) 48}