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 package activityserve
import ( import (
"bytes"
"encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http"
"github.com/gologme/log" "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 // RemoteActor is a type that holds an actor
// that we want to interact with // that we want to interact with
type RemoteActor struct { type RemoteActor struct {
iri, outbox, inbox string iri, outbox, inbox, sharedInbox string
info map[string]interface{} info map[string]interface{}
} }
@ -38,11 +31,14 @@ func NewRemoteActor(iri string) (RemoteActor, error) {
outbox := info["outbox"].(string) outbox := info["outbox"].(string)
inbox := info["inbox"].(string) inbox := info["inbox"].(string)
endpoints := info["endpoints"].(map[string]interface{})
sharedInbox := endpoints["sharedInbox"].(string)
return RemoteActor{ return RemoteActor{
iri: iri, iri: iri,
outbox: outbox, outbox: outbox,
inbox: inbox, inbox: inbox,
sharedInbox: sharedInbox,
}, err }, err
} }
@ -96,3 +92,8 @@ func get(iri string) (info map[string]interface{}, err error) {
func (ra RemoteActor) GetInbox() string { func (ra RemoteActor) GetInbox() string {
return ra.inbox return ra.inbox
} }
// GetSharedInbox returns the inbox url of the actor
func (ra RemoteActor) GetSharedInbox() string {
return ra.sharedInbox
}