Add sharedInbox to remoteActor because it's needed by writefreely

pull/15/head
Michael Demetriou 2019-10-10 19:56:21 +03:00
parent 5fc3b48e70
commit 1d173c5d57
1 changed files with 16 additions and 15 deletions

View File

@ -1,26 +1,19 @@
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
iri, outbox, inbox, sharedInbox string
info map[string]interface{}
}
@ -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,
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
}