(ctx *Context)
| 15 | |
| 16 | type FetchActorCmd struct { |
| 17 | Account string `required:"" help:"The account to sign the request with."` |
| 18 | Actor string `required:"" help:"The actor to fetch."` |
| 19 | } |
| 20 | |
| 21 | func (f *FetchActorCmd) Run(ctx *Context) error { |
| 22 | db, err := gorm.Open(ctx.Dialector, &ctx.Config) |
| 23 | if err != nil { |
| 24 | return err |
| 25 | } |
| 26 | |
| 27 | signAs, err := models.NewActors(db).FindByURI(f.Account) |
| 28 | if err != nil { |
| 29 | return fmt.Errorf("failed to find actor: %w", err) |
| 30 | } |
| 31 | account, err := models.NewAccounts(db).AccountForActor(signAs) |
| 32 | if err != nil { |
| 33 | return fmt.Errorf("failed to find account: %w", err) |
| 34 | } |
| 35 | |
| 36 | orig, err := models.NewActors(db).FindByURI(f.Actor) |
| 37 | if err != nil { |
| 38 | return fmt.Errorf("failed to find actor: %w", err) |
| 39 | } |
| 40 | |
| 41 | updated, err := activitypub.NewRemoteActorFetcher(account).Fetch(context.Background(), f.Actor) |
| 42 | if err != nil { |
| 43 | return fmt.Errorf("failed to fetch actor: %w", err) |
| 44 | } |
| 45 |
nothing calls this directly
no test coverage detected