diff options
author | 2025-01-23 17:18:23 +0000 | |
---|---|---|
committer | 2025-01-23 18:18:23 +0100 | |
commit | 9333bbc4d0d5ae46c72fca1f5b1aacb3c0a7653e (patch) | |
tree | e7ccd1dc3abff5386e0b86e6baf659c9aa3b55a5 /internal/processing | |
parent | [feature] Add warning about `trusted-proxies` to make config easier (#3675) (diff) | |
download | gotosocial-9333bbc4d0d5ae46c72fca1f5b1aacb3c0a7653e.tar.xz |
[feature] Serve bot accounts over AP as Service instead of Person (#3672)
* pepis
* oopsie doopsie
* bollocks
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/fedi/user.go | 13 | ||||
-rw-r--r-- | internal/processing/workers/federate.go | 23 |
2 files changed, 12 insertions, 24 deletions
diff --git a/internal/processing/fedi/user.go b/internal/processing/fedi/user.go index bf14554cf..79c1b4fdb 100644 --- a/internal/processing/fedi/user.go +++ b/internal/processing/fedi/user.go @@ -23,7 +23,6 @@ import ( "fmt" "net/url" - "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtserror" @@ -72,7 +71,7 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque } // Auth passed, generate the proper AP representation. - person, err := p.converter.AccountToAS(ctx, receiver) + accountable, err := p.converter.AccountToAS(ctx, receiver) if err != nil { err := gtserror.Newf("error converting account: %w", err) return nil, gtserror.NewErrorInternalError(err) @@ -91,7 +90,7 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque // Instead, we end up in an 'I'll show you mine if you show me // yours' situation, where we sort of agree to reveal each // other's profiles at the same time. - return data(person) + return data(accountable) } // Get requester from auth. @@ -107,13 +106,13 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque return nil, gtserror.NewErrorForbidden(errors.New(text)) } - return data(person) + return data(accountable) } -func data(requestedPerson vocab.ActivityStreamsPerson) (interface{}, gtserror.WithCode) { - data, err := ap.Serialize(requestedPerson) +func data(accountable ap.Accountable) (interface{}, gtserror.WithCode) { + data, err := ap.Serialize(accountable) if err != nil { - err := gtserror.Newf("error serializing person: %w", err) + err := gtserror.Newf("error serializing accountable: %w", err) return nil, gtserror.NewErrorInternalError(err) } diff --git a/internal/processing/workers/federate.go b/internal/processing/workers/federate.go index 8c08c42b7..d6dec6691 100644 --- a/internal/processing/workers/federate.go +++ b/internal/processing/workers/federate.go @@ -21,7 +21,6 @@ import ( "context" "net/url" - "github.com/superseriousbusiness/activity/pub" "github.com/superseriousbusiness/activity/streams" "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" @@ -93,11 +92,6 @@ func (f *federate) DeleteAccount(ctx context.Context, account *gtsmodel.Account) return err } - publicIRI, err := parseURI(pub.PublicActivityPubIRI) - if err != nil { - return err - } - // Create a new delete. // todo: tc.AccountToASDelete delete := streams.NewActivityStreamsDelete() @@ -121,7 +115,7 @@ func (f *federate) DeleteAccount(ctx context.Context, account *gtsmodel.Account) // Address the delete CC public. deleteCC := streams.NewActivityStreamsCcProperty() - deleteCC.AppendIRI(publicIRI) + deleteCC.AppendIRI(ap.PublicURI()) delete.SetActivityStreamsCc(deleteCC) // Send the Delete via the Actor's outbox. @@ -877,14 +871,14 @@ func (f *federate) UpdateAccount(ctx context.Context, account *gtsmodel.Account) return err } - // Convert account to ActivityStreams Person. - person, err := f.converter.AccountToAS(ctx, account) + // Convert account to Accountable. + accountable, err := f.converter.AccountToAS(ctx, account) if err != nil { return gtserror.Newf("error converting account to Person: %w", err) } - // Use ActivityStreams Person as Object of Update. - update, err := f.converter.WrapPersonInUpdate(person, account) + // Use Accountable as Object of Update. + update, err := f.converter.WrapAccountableInUpdate(accountable) if err != nil { return gtserror.Newf("error wrapping Person in Update: %w", err) } @@ -1089,11 +1083,6 @@ func (f *federate) MoveAccount(ctx context.Context, account *gtsmodel.Account) e return err } - publicIRI, err := parseURI(pub.PublicActivityPubIRI) - if err != nil { - return err - } - // Create a new move. move := streams.NewActivityStreamsMove() @@ -1115,7 +1104,7 @@ func (f *federate) MoveAccount(ctx context.Context, account *gtsmodel.Account) e ap.AppendTo(move, followersIRI) // Address the move CC public. - ap.AppendCc(move, publicIRI) + ap.AppendCc(move, ap.PublicURI()) // Send the Move via the Actor's outbox. if _, err := f.FederatingActor().Send( |