From 1d173c5d57ddfe17a3a4e3407aa0087408b48035 Mon Sep 17 00:00:00 2001 From: Michael Demetriou Date: Thu, 10 Oct 2019 19:56:21 +0300 Subject: [PATCH] Add sharedInbox to remoteActor because it's needed by writefreely --- remoteActor.go | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/remoteActor.go b/remoteActor.go index 07da0ba..a87ba23 100644 --- a/remoteActor.go +++ b/remoteActor.go @@ -1,27 +1,20 @@ package activityserve import ( + "bytes" + "encoding/json" "fmt" "io/ioutil" + "net/http" "github.com/gologme/log" - - // "github.com/go-fed/activity/pub" - // "github.com/go-fed/httpsig" - - "net/http" - // "net/url" - - "encoding/json" - - "bytes" ) // RemoteActor is a type that holds an actor // that we want to interact with type RemoteActor struct { - iri, outbox, inbox string - info map[string]interface{} + iri, outbox, inbox, sharedInbox string + info map[string]interface{} } // NewRemoteActor returns a remoteActor which holds @@ -38,11 +31,14 @@ func NewRemoteActor(iri string) (RemoteActor, error) { outbox := info["outbox"].(string) inbox := info["inbox"].(string) + endpoints := info["endpoints"].(map[string]interface{}) + sharedInbox := endpoints["sharedInbox"].(string) return RemoteActor{ - iri: iri, - outbox: outbox, - inbox: inbox, + iri: iri, + outbox: outbox, + inbox: inbox, + sharedInbox: sharedInbox, }, err } @@ -96,3 +92,8 @@ func get(iri string) (info map[string]interface{}, err error) { func (ra RemoteActor) GetInbox() string { return ra.inbox } + +// GetSharedInbox returns the inbox url of the actor +func (ra RemoteActor) GetSharedInbox() string { + return ra.sharedInbox +}