diff --git a/integrations/api_activitypub_person_test.go b/integrations/api_activitypub_person_test.go index e19da40864..9e9f7dd7f2 100644 --- a/integrations/api_activitypub_person_test.go +++ b/integrations/api_activitypub_person_test.go @@ -42,10 +42,10 @@ func TestActivityPubPerson(t *testing.T) { assert.Equal(t, ap.PersonType, person.Type) assert.Equal(t, username, person.PreferredUsername.String()) - keyID := person.GetID().String() + keyID := person.GetLink().String() assert.Regexp(t, fmt.Sprintf("activitypub/user/%s$", username), keyID) - assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/outbox$", username), person.Outbox.GetID().String()) - assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/inbox$", username), person.Inbox.GetID().String()) + assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/outbox$", username), person.Outbox.GetLink().String()) + assert.Regexp(t, fmt.Sprintf("activitypub/user/%s/inbox$", username), person.Inbox.GetLink().String()) pubKey := person.PublicKey assert.NotNil(t, pubKey) diff --git a/modules/activitypub/follow.go b/modules/activitypub/follow.go index f606e59df9..9db9e534cd 100644 --- a/modules/activitypub/follow.go +++ b/modules/activitypub/follow.go @@ -16,14 +16,14 @@ import ( // Process a Follow activity func Follow(ctx context.Context, follow ap.Follow) error { // Actor is the user performing the follow - actorIRI := follow.Actor.GetID() + actorIRI := follow.Actor.GetLink() actorUser, err := personIRIToUser(ctx, actorIRI) if err != nil { return err } // Object is the user being followed - objectIRI := follow.Object.GetID() + objectIRI := follow.Object.GetLink() objectUser, err := personIRIToUser(ctx, objectIRI) // Must be a local user if err != nil || strings.Contains(objectUser.Name, "@") { @@ -47,14 +47,14 @@ func Follow(ctx context.Context, follow ap.Follow) error { func Unfollow(ctx context.Context, unfollow ap.Undo) error { follow := unfollow.Object.(*ap.Follow) // Actor is the user performing the undo follow - actorIRI := follow.Actor.GetID() + actorIRI := follow.Actor.GetLink() actorUser, err := personIRIToUser(ctx, actorIRI) if err != nil { return err } // Object is the user being unfollowed - objectIRI := follow.Object.GetID() + objectIRI := follow.Object.GetLink() objectUser, err := personIRIToUser(ctx, objectIRI) // Must be a local user if err != nil || strings.Contains(objectUser.Name, "@") { diff --git a/modules/activitypub/fork.go b/modules/activitypub/fork.go index 209a59a675..5a89ed3540 100644 --- a/modules/activitypub/fork.go +++ b/modules/activitypub/fork.go @@ -52,7 +52,7 @@ func ForkFromCreate(ctx context.Context, repository forgefed.Repository) error { // https://gitea.com/Ta180m/gitea/issues/7 // Create the fork - repoIRI := repository.GetID() + repoIRI := repository.GetLink() repoIRISplit := strings.Split(repoIRI.String(), "/") instance := repoIRISplit[2] username := repoIRISplit[7] diff --git a/modules/activitypub/transport.go b/modules/activitypub/transport.go index 4d860f4314..4ac2a63d6f 100644 --- a/modules/activitypub/transport.go +++ b/modules/activitypub/transport.go @@ -52,7 +52,7 @@ func Send(user *user_model.User, activity *ap.Activity) error { for _, to := range activity.To { client, _ := NewClient(user, setting.AppURL+"api/v1/activitypub/user/"+user.Name+"#main-key") - resp, _ := client.Post(binary, to.GetID().String()) + resp, _ := client.Post(binary, to.GetLink().String()) respBody, _ := io.ReadAll(io.LimitReader(resp.Body, setting.Federation.MaxSize)) log.Trace("Response from sending activity", string(respBody)) } diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go index 85230c0d83..a78368c68e 100644 --- a/routers/api/v1/activitypub/person.go +++ b/routers/api/v1/activitypub/person.go @@ -116,11 +116,11 @@ func PersonInbox(ctx *context.APIContext) { // Make sure keyID matches the user doing the activity _, keyID, _ := getKeyID(ctx.Req) - if activity.Actor != nil && !strings.HasPrefix(keyID, activity.Actor.GetID().String()) { + if activity.Actor != nil && !strings.HasPrefix(keyID, activity.Actor.GetLink().String()) { ctx.ServerError("Actor does not match HTTP signature keyID", nil) return } - if activity.AttributedTo != nil && !strings.HasPrefix(keyID, activity.AttributedTo.GetID().String()) { + if activity.AttributedTo != nil && !strings.HasPrefix(keyID, activity.AttributedTo.GetLink().String()) { ctx.ServerError("AttributedTo does not match HTTP signature keyID", nil) return } diff --git a/routers/api/v1/activitypub/repo.go b/routers/api/v1/activitypub/repo.go index 73a85605ab..3c7712a1c9 100644 --- a/routers/api/v1/activitypub/repo.go +++ b/routers/api/v1/activitypub/repo.go @@ -105,11 +105,11 @@ func RepoInbox(ctx *context.APIContext) { // Make sure keyID matches the user doing the activity _, keyID, _ := getKeyID(ctx.Req) - if activity.Actor != nil && !strings.HasPrefix(keyID, activity.Actor.GetID().String()) { + if activity.Actor != nil && !strings.HasPrefix(keyID, activity.Actor.GetLink().String()) { ctx.ServerError("Actor does not match HTTP signature keyID", nil) return } - if activity.AttributedTo != nil && !strings.HasPrefix(keyID, activity.AttributedTo.GetID().String()) { + if activity.AttributedTo != nil && !strings.HasPrefix(keyID, activity.AttributedTo.GetLink().String()) { ctx.ServerError("AttributedTo does not match HTTP signature keyID", nil) return }