this repo has no description
0
fork

Configure Feed

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

fix a lexgen bug and update routes to fix

+161 -86
+43 -2
lex/gen.go
··· 747 747 required[k] = true 748 748 } 749 749 } 750 - orderedMapIter[*TypeSchema](s.Parameters.Properties, func(k string, t *TypeSchema) error { 750 + if err := orderedMapIter[*TypeSchema](s.Parameters.Properties, func(k string, t *TypeSchema) error { 751 751 switch t.Type { 752 752 case "string": 753 753 params = append(params, k) ··· 795 795 796 796 case "number": 797 797 return fmt.Errorf("non-integer numbers currently unsupported") 798 + case "boolean": 799 + params = append(params, k) 800 + if !required[k] { 801 + paramtypes = append(paramtypes, k+" *bool") 802 + fmt.Fprintf(w, ` 803 + var %s *bool 804 + if p := c.QueryParam("%s"); p != "" { 805 + %s_val, err := strconv.ParseBool(p) 806 + if err != nil { 807 + return err 808 + } 809 + %s = &%s_val 810 + } 811 + `, k, k, k, k, k) 812 + } else if t.Default != nil { 813 + paramtypes = append(paramtypes, k+" bool") 814 + fmt.Fprintf(w, ` 815 + var %s bool 816 + if p := c.QueryParam("%s"); p != "" { 817 + var err error 818 + %s, err = strconv.ParseBool(p) 819 + if err != nil { 820 + return err 821 + } 822 + } else { 823 + %s = %T 824 + } 825 + `, k, k, k, k, t.Default.(bool)) 826 + } else { 827 + 828 + paramtypes = append(paramtypes, k+" bool") 829 + fmt.Fprintf(w, ` 830 + %s, err := strconv.ParseBool(c.QueryParam("%s")) 831 + if err != nil { 832 + return err 833 + } 834 + `, k, k) 835 + } 836 + 798 837 default: 799 838 return fmt.Errorf("unsupported handler parameter type: %s", t.Type) 800 839 } 801 840 return nil 802 - }) 841 + }); err != nil { 842 + return err 843 + } 803 844 } 804 845 } else if s.Type == "procedure" { 805 846 if s.Input != nil {
+2 -2
repomgr/repomgr.go
··· 67 67 const ( 68 68 EvtKindCreateRecord = EventKind("createRecord") 69 69 EvtKindUpdateRecord = EventKind("updateRecord") 70 + EvtKindDeleteRecord = EventKind("deleteRecord") 70 71 EvtKindInitActor = EventKind("initActor") 71 72 ) 72 73 ··· 285 286 } 286 287 287 288 rpath := collection + "/" + rkey 288 - cc, err := r.DeleteRecord(ctx, rpath) 289 - if err != nil { 289 + if err := r.DeleteRecord(ctx, rpath); err != nil { 290 290 return err 291 291 } 292 292
+4 -2
server/handlers.go
··· 292 292 } 293 293 } 294 294 295 - func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context, assertion string, author string, before string) (*appbskytypes.GraphGetAssertions_Output, error) { 295 + func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context, assertion string, author string, before string, confirmed *bool, limit int, subject string) (*appbskytypes.GraphGetAssertions_Output, error) { 296 296 panic("not yet implemented") 297 297 } 298 298 ··· 460 460 return nil, err 461 461 } 462 462 463 + _ = u 464 + 463 465 return nil, fmt.Errorf("invite codes not currently supported") 464 466 } 465 467 ··· 576 578 }, nil 577 579 } 578 580 579 - func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context, after string, before string, collection string, limit int) (*comatprototypes.RepoListRecords_Output, error) { 581 + func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context, after string, before string, collection string, limit int, reverse *bool, user string) (*comatprototypes.RepoListRecords_Output, error) { 580 582 panic("not yet implemented") 581 583 } 582 584
-7
server/indexer.go
··· 31 31 db.AutoMigrate(&FollowRecord{}) 32 32 db.AutoMigrate(&VoteRecord{}) 33 33 db.AutoMigrate(&RepostRecord{}) 34 - db.AutoMigrate(&ExternalFollow{}) 35 34 36 35 return &Indexer{ 37 36 db: db, ··· 111 110 Target uint 112 111 Rkey string 113 112 Cid string 114 - } 115 - 116 - type ExternalFollow struct { 117 - gorm.Model 118 - PDS uint 119 - Uid uint 120 113 } 121 114 122 115 func (ix *Indexer) catchup(ctx context.Context, evt *repomgr.RepoEvent) error {
+7
server/server.go
··· 58 58 func NewServer(db *gorm.DB, cs *carstore.CarStore, kfile string, handleSuffix, serviceUrl string, didr PLCClient, jwtkey []byte) (*Server, error) { 59 59 db.AutoMigrate(&User{}) 60 60 db.AutoMigrate(&Peering{}) 61 + db.AutoMigrate(&ExternalFollow{}) 61 62 62 63 serkey, err := loadKey(kfile) 63 64 if err != nil { ··· 523 524 } 524 525 525 526 return nil 527 + } 528 + 529 + type ExternalFollow struct { 530 + gorm.Model 531 + PDS uint 532 + Uid uint 526 533 } 527 534 528 535 func (s *Server) AddRemoteFollow(ctx context.Context, opdsdid string, u string) error {
+105 -73
server/stubs.go
··· 34 34 e.GET("/xrpc/app.bsky.notification.getCount", s.HandleAppBskyNotificationGetCount) 35 35 e.GET("/xrpc/app.bsky.notification.list", s.HandleAppBskyNotificationList) 36 36 e.POST("/xrpc/app.bsky.notification.updateSeen", s.HandleAppBskyNotificationUpdateSeen) 37 + 38 + e.POST("/xrpc/com.atproto.peering.follow", s.HandleComAtprotoPeeringFollow) 39 + e.POST("/xrpc/com.atproto.peering.init", s.HandleComAtprotoPeeringInit) 40 + e.GET("/xrpc/com.atproto.peering.list", s.HandleComAtprotoPeeringList) 41 + e.POST("/xrpc/com.atproto.peering.propose", s.HandleComAtprotoPeeringPropose) 37 42 return nil 38 43 } 39 44 ··· 317 322 assertion := c.QueryParam("assertion") 318 323 author := c.QueryParam("author") 319 324 before := c.QueryParam("before") 325 + 326 + var confirmed *bool 327 + if p := c.QueryParam("confirmed"); p != "" { 328 + confirmed_val, err := strconv.ParseBool(p) 329 + if err != nil { 330 + return err 331 + } 332 + confirmed = &confirmed_val 333 + } 334 + 335 + var limit int 336 + if p := c.QueryParam("limit"); p != "" { 337 + var err error 338 + limit, err = strconv.Atoi(p) 339 + if err != nil { 340 + return err 341 + } 342 + } else { 343 + limit = 50 344 + } 345 + subject := c.QueryParam("subject") 320 346 var out *appbskytypes.GraphGetAssertions_Output 321 347 var handleErr error 322 - // func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context,assertion string,author string,before string) (*appbskytypes.GraphGetAssertions_Output, error) 323 - out, handleErr = s.handleAppBskyGraphGetAssertions(ctx, assertion, author, before) 348 + // func (s *Server) handleAppBskyGraphGetAssertions(ctx context.Context,assertion string,author string,before string,confirmed *bool,limit int,subject string) (*appbskytypes.GraphGetAssertions_Output, error) 349 + out, handleErr = s.handleAppBskyGraphGetAssertions(ctx, assertion, author, before, confirmed, limit, subject) 324 350 if handleErr != nil { 325 351 return handleErr 326 352 } ··· 554 580 e.POST("/xrpc/com.atproto.account.resetPassword", s.HandleComAtprotoAccountResetPassword) 555 581 e.POST("/xrpc/com.atproto.blob.upload", s.HandleComAtprotoBlobUpload) 556 582 e.GET("/xrpc/com.atproto.handle.resolve", s.HandleComAtprotoHandleResolve) 557 - e.POST("/xrpc/com.atproto.peering.follow", s.HandleComAtprotoPeeringFollow) 558 - e.POST("/xrpc/com.atproto.peering.init", s.HandleComAtprotoPeeringInit) 559 - e.GET("/xrpc/com.atproto.peering.list", s.HandleComAtprotoPeeringList) 560 - e.POST("/xrpc/com.atproto.peering.propose", s.HandleComAtprotoPeeringPropose) 561 583 e.POST("/xrpc/com.atproto.repo.batchWrite", s.HandleComAtprotoRepoBatchWrite) 562 584 e.POST("/xrpc/com.atproto.repo.createRecord", s.HandleComAtprotoRepoCreateRecord) 563 585 e.POST("/xrpc/com.atproto.repo.deleteRecord", s.HandleComAtprotoRepoDeleteRecord) ··· 699 721 return c.JSON(200, out) 700 722 } 701 723 702 - func (s *Server) HandleComAtprotoPeeringFollow(c echo.Context) error { 703 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringFollow") 704 - defer span.End() 705 - 706 - var body comatprototypes.PeeringFollow_Input 707 - if err := c.Bind(&body); err != nil { 708 - return err 709 - } 710 - var handleErr error 711 - // func (s *Server) handleComAtprotoPeeringFollow(ctx context.Context,body *comatprototypes.PeeringFollow_Input) error 712 - handleErr = s.handleComAtprotoPeeringFollow(ctx, &body) 713 - if handleErr != nil { 714 - return handleErr 715 - } 716 - return nil 717 - } 718 - 719 - func (s *Server) HandleComAtprotoPeeringInit(c echo.Context) error { 720 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringInit") 721 - defer span.End() 722 - 723 - var body comatprototypes.PeeringInit_Input 724 - if err := c.Bind(&body); err != nil { 725 - return err 726 - } 727 - var handleErr error 728 - // func (s *Server) handleComAtprotoPeeringInit(ctx context.Context,body *comatprototypes.PeeringInit_Input) error 729 - handleErr = s.handleComAtprotoPeeringInit(ctx, &body) 730 - if handleErr != nil { 731 - return handleErr 732 - } 733 - return nil 734 - } 735 - 736 - func (s *Server) HandleComAtprotoPeeringList(c echo.Context) error { 737 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringList") 738 - defer span.End() 739 - var out *comatprototypes.PeeringList_Output 740 - var handleErr error 741 - // func (s *Server) handleComAtprotoPeeringList(ctx context.Context) (*comatprototypes.PeeringList_Output, error) 742 - out, handleErr = s.handleComAtprotoPeeringList(ctx) 743 - if handleErr != nil { 744 - return handleErr 745 - } 746 - return c.JSON(200, out) 747 - } 748 - 749 - func (s *Server) HandleComAtprotoPeeringPropose(c echo.Context) error { 750 - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringPropose") 751 - defer span.End() 752 - 753 - var body comatprototypes.PeeringPropose_Input 754 - if err := c.Bind(&body); err != nil { 755 - return err 756 - } 757 - var out *comatprototypes.PeeringPropose_Output 758 - var handleErr error 759 - // func (s *Server) handleComAtprotoPeeringPropose(ctx context.Context,body *comatprototypes.PeeringPropose_Input) (*comatprototypes.PeeringPropose_Output, error) 760 - out, handleErr = s.handleComAtprotoPeeringPropose(ctx, &body) 761 - if handleErr != nil { 762 - return handleErr 763 - } 764 - return c.JSON(200, out) 765 - } 766 - 767 724 func (s *Server) HandleComAtprotoRepoBatchWrite(c echo.Context) error { 768 725 ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoRepoBatchWrite") 769 726 defer span.End() ··· 864 821 } else { 865 822 limit = 50 866 823 } 824 + 825 + var reverse *bool 826 + if p := c.QueryParam("reverse"); p != "" { 827 + reverse_val, err := strconv.ParseBool(p) 828 + if err != nil { 829 + return err 830 + } 831 + reverse = &reverse_val 832 + } 833 + user := c.QueryParam("user") 867 834 var out *comatprototypes.RepoListRecords_Output 868 835 var handleErr error 869 - // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,after string,before string,collection string,limit int) (*comatprototypes.RepoListRecords_Output, error) 870 - out, handleErr = s.handleComAtprotoRepoListRecords(ctx, after, before, collection, limit) 836 + // func (s *Server) handleComAtprotoRepoListRecords(ctx context.Context,after string,before string,collection string,limit int,reverse *bool,user string) (*comatprototypes.RepoListRecords_Output, error) 837 + out, handleErr = s.handleComAtprotoRepoListRecords(ctx, after, before, collection, limit, reverse, user) 871 838 if handleErr != nil { 872 839 return handleErr 873 840 } ··· 1002 969 } 1003 970 return nil 1004 971 } 972 + 973 + func (s *Server) HandleComAtprotoPeeringFollow(c echo.Context) error { 974 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringFollow") 975 + defer span.End() 976 + 977 + var body comatprototypes.PeeringFollow_Input 978 + if err := c.Bind(&body); err != nil { 979 + return err 980 + } 981 + var handleErr error 982 + // func (s *Server) handleComAtprotoPeeringFollow(ctx context.Context,body *comatprototypes.PeeringFollow_Input) error 983 + handleErr = s.handleComAtprotoPeeringFollow(ctx, &body) 984 + if handleErr != nil { 985 + return handleErr 986 + } 987 + return nil 988 + } 989 + 990 + func (s *Server) HandleComAtprotoPeeringInit(c echo.Context) error { 991 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringInit") 992 + defer span.End() 993 + 994 + var body comatprototypes.PeeringInit_Input 995 + if err := c.Bind(&body); err != nil { 996 + return err 997 + } 998 + var handleErr error 999 + // func (s *Server) handleComAtprotoPeeringInit(ctx context.Context,body *comatprototypes.PeeringInit_Input) error 1000 + handleErr = s.handleComAtprotoPeeringInit(ctx, &body) 1001 + if handleErr != nil { 1002 + return handleErr 1003 + } 1004 + return nil 1005 + } 1006 + 1007 + func (s *Server) HandleComAtprotoPeeringList(c echo.Context) error { 1008 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringList") 1009 + defer span.End() 1010 + var out *comatprototypes.PeeringList_Output 1011 + var handleErr error 1012 + // func (s *Server) handleComAtprotoPeeringList(ctx context.Context) (*comatprototypes.PeeringList_Output, error) 1013 + out, handleErr = s.handleComAtprotoPeeringList(ctx) 1014 + if handleErr != nil { 1015 + return handleErr 1016 + } 1017 + return c.JSON(200, out) 1018 + } 1019 + 1020 + func (s *Server) HandleComAtprotoPeeringPropose(c echo.Context) error { 1021 + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoPeeringPropose") 1022 + defer span.End() 1023 + 1024 + var body comatprototypes.PeeringPropose_Input 1025 + if err := c.Bind(&body); err != nil { 1026 + return err 1027 + } 1028 + var out *comatprototypes.PeeringPropose_Output 1029 + var handleErr error 1030 + // func (s *Server) handleComAtprotoPeeringPropose(ctx context.Context,body *comatprototypes.PeeringPropose_Input) (*comatpototypes.PeeringPropose_Output, error) 1031 + out, handleErr = s.handleComAtprotoPeeringPropose(ctx, &body) 1032 + if handleErr != nil { 1033 + return handleErr 1034 + } 1035 + return c.JSON(200, out) 1036 + }