Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(ap): resolve issue where follows would not work if private mode was enabled. Fixes #4142 (#4202)

Gabe Kangas26abbf088380
diff --git a/activitypub/inbox/follow.go b/activitypub/inbox/follow.go
index 6c4c3378be..21d0ecba10 100644
--- a/activitypub/inbox/follow.go
+++ b/activitypub/inbox/follow.go
@@ -47,7 +47,7 @@ func handleFollowInboxRequest(c context.Context, activity vocab.ActivityStreamsF
}
}
- // Save as an accepted activity
+ // Save as an activity
actorReference := activity.GetActivityStreamsActor()
object := activity.GetActivityStreamsObject()
objectIRI := object.At(0).GetIRI().String()
diff --git a/activitypub/persistence/persistence.go b/activitypub/persistence/persistence.go
index e83933e939..4127829346 100644
--- a/activitypub/persistence/persistence.go
+++ b/activitypub/persistence/persistence.go
@@ -3,6 +3,7 @@ package persistence
import (
"context"
"database/sql"
+ "encoding/json"
"fmt"
"net/url"
"time"
@@ -74,6 +75,27 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
return nil, errors.Wrap(err, "error parsing acting inbox")
}
+ requestObjectBytes := result.RequestObject
+ var followRequestObject vocab.ActivityStreamsFollow
+
+ resolver, err := streams.NewJSONResolver(func(c context.Context, followObject vocab.ActivityStreamsFollow) error {
+ followRequestObject = followObject
+ return nil
+ })
+ if err != nil {
+ return nil, errors.Wrap(err, "error creating JSON resolver")
+ }
+ jsonMap := make(map[string]interface{})
+ err = json.Unmarshal(requestObjectBytes, &jsonMap)
+ if err != nil {
+ return nil, errors.Wrap(err, "error unmarshaling follow request object")
+ }
+
+ err = resolver.Resolve(context.Background(), jsonMap)
+ if err != nil {
+ return nil, errors.Wrap(err, "error resolving follow request object")
+ }
+
image, _ := url.Parse(result.Image.String)
var disabledAt *time.Time
@@ -89,6 +111,7 @@ func GetFollower(iri string) (*apmodels.ActivityPubActor, error) {
Image: image,
FollowRequestIri: followIRI,
DisabledAt: disabledAt,
+ RequestObject: followRequestObject,
}
return &follower, nil