porting all github actions from bluesky-social/indigo to tangled CI

fix handle resolution in some cli commands (#631)

probably more of this to come, the ProdHandleResolver type is basically
broken now

authored by bnewbold.net and committed by GitHub b5826759 dcbf733f

Changed files
+23 -13
cmd
+11 -7
cmd/gosky/admin.go
··· 29 29 EnvVars: []string{"ATP_AUTH_ADMIN_PASSWORD"}, 30 30 Required: true, 31 31 }, 32 + &cli.StringFlag{ 33 + Name: "admin-endpoint", 34 + Value: "https://mod.bsky.app", 35 + }, 32 36 }, 33 37 Subcommands: []*cli.Command{ 34 38 buildInviteTreeCmd, ··· 78 82 79 83 adminKey := cctx.String("admin-password") 80 84 xrpcc.AdminToken = &adminKey 81 - xrpcc.Host = id.PDSEndpoint() 85 + xrpcc.Host = cctx.String("admin-endpoint") 82 86 83 87 rep, err := toolsozone.ModerationGetRepo(ctx, xrpcc, did) 84 88 if err != nil { ··· 623 627 624 628 for _, did := range cctx.Args().Slice() { 625 629 if !strings.HasPrefix(did, "did:") { 626 - phr := &api.ProdHandleResolver{} 627 - resp, err := phr.ResolveHandleToDid(ctx, did) 630 + dir := identity.DefaultDirectory() 631 + resp, err := dir.LookupHandle(ctx, syntax.Handle(did)) 628 632 if err != nil { 629 633 return err 630 634 } 631 635 632 - did = resp 636 + did = resp.DID.String() 633 637 } 634 638 635 639 reason := cctx.String("reason") 636 640 adminUser := cctx.String("admin-user") 637 641 if !strings.HasPrefix(adminUser, "did:") { 638 - phr := &api.ProdHandleResolver{} 639 - resp, err := phr.ResolveHandleToDid(ctx, adminUser) 642 + dir := identity.DefaultDirectory() 643 + resp, err := dir.LookupHandle(ctx, syntax.Handle(adminUser)) 640 644 if err != nil { 641 645 return err 642 646 } 643 647 644 - adminUser = resp 648 + adminUser = resp.DID.String() 645 649 } 646 650 647 651 resp, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{
+11 -5
cmd/gosky/handle.go
··· 4 4 "context" 5 5 "fmt" 6 6 7 - api "github.com/bluesky-social/indigo/api" 8 7 comatproto "github.com/bluesky-social/indigo/api/atproto" 8 + "github.com/bluesky-social/indigo/atproto/identity" 9 + "github.com/bluesky-social/indigo/atproto/syntax" 9 10 "github.com/bluesky-social/indigo/util/cliutil" 10 11 11 12 cli "github.com/urfave/cli/v2" ··· 30 31 if err != nil { 31 32 return err 32 33 } 33 - handle := args[0] 34 + 35 + h, err := syntax.ParseHandle(args[0]) 36 + if err != nil { 37 + return fmt.Errorf("resolving %q: %w", args[0], err) 38 + } 39 + 40 + dir := identity.DefaultDirectory() 34 41 35 - phr := &api.ProdHandleResolver{} 36 - out, err := phr.ResolveHandleToDid(ctx, handle) 42 + res, err := dir.LookupHandle(ctx, h) 37 43 if err != nil { 38 44 return err 39 45 } 40 46 41 - fmt.Println(out) 47 + fmt.Println(res.DID) 42 48 43 49 return nil 44 50 },
+1 -1
cmd/gosky/main.go
··· 765 765 since := time.Now().Add(-1 * delta).UnixMilli() 766 766 767 767 xrpcc := &xrpc.Client{ 768 - Host: "https://api.bsky.app", 768 + Host: "https://mod.bsky.app", 769 769 } 770 770 771 771 for {