this repo has no description
0
fork

Configure Feed

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

some tweaks to gosky commands (#190)

allow did resolve to just print the handle, allow handing out invites to
a did

authored by

Whyrusleeping and committed by
GitHub
a206cdf4 e7c7833e

+34 -6
+34 -6
cmd/gosky/main.go
··· 13 13 "syscall" 14 14 "time" 15 15 16 + "github.com/bluesky-social/indigo/api" 16 17 "github.com/bluesky-social/indigo/api/atproto" 17 18 comatproto "github.com/bluesky-social/indigo/api/atproto" 18 19 "github.com/bluesky-social/indigo/api/bsky" ··· 214 215 var didGetCmd = &cli.Command{ 215 216 Name: "get", 216 217 ArgsUsage: `<did>`, 218 + Flags: []cli.Flag{ 219 + &cli.BoolFlag{ 220 + Name: "handle", 221 + Usage: "resolve did to handle and print", 222 + }, 223 + }, 217 224 Action: func(cctx *cli.Context) error { 218 225 s := cliutil.GetDidResolver(cctx) 219 226 220 - doc, err := s.GetDocument(context.TODO(), cctx.Args().First()) 227 + did := cctx.Args().First() 228 + 229 + if cctx.Bool("handle") { 230 + xrpcc, err := cliutil.GetXrpcClient(cctx, false) 231 + if err != nil { 232 + return err 233 + } 234 + 235 + h, _, err := api.ResolveDidToHandle(context.TODO(), xrpcc, s, did) 236 + if err != nil { 237 + return err 238 + } 239 + 240 + fmt.Println(h) 241 + return nil 242 + } 243 + 244 + doc, err := s.GetDocument(context.TODO(), did) 221 245 if err != nil { 222 246 return err 223 247 } ··· 1143 1167 1144 1168 var usrdid []string 1145 1169 if forUser := cctx.Args().Get(0); forUser != "" { 1146 - resp, err := comatproto.IdentityResolveHandle(context.TODO(), xrpcc, forUser) 1147 - if err != nil { 1148 - return fmt.Errorf("resolving handle: %w", err) 1149 - } 1170 + if !strings.HasPrefix(forUser, "did:") { 1171 + resp, err := comatproto.IdentityResolveHandle(context.TODO(), xrpcc, forUser) 1172 + if err != nil { 1173 + return fmt.Errorf("resolving handle: %w", err) 1174 + } 1150 1175 1151 - usrdid = []string{resp.Did} 1176 + usrdid = []string{resp.Did} 1177 + } else { 1178 + usrdid = []string{forUser} 1179 + } 1152 1180 } 1153 1181 1154 1182 xrpcc.AdminToken = &adminKey