If the remote actor does not have a sharedInbox then return their
inbox so implementations do not need to care whethere there is a sharedInbox or notpull/15/head
parent
1d173c5d57
commit
c4bb553217
|
@ -1,13 +1,20 @@
|
||||||
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
|
||||||
|
@ -31,8 +38,12 @@ 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{})
|
var endpoints map[string]interface{}
|
||||||
sharedInbox := endpoints["sharedInbox"].(string)
|
var sharedInbox string
|
||||||
|
if info["endpoints"] != nil {
|
||||||
|
endpoints = info["endpoints"].(map[string]interface{})
|
||||||
|
sharedInbox = endpoints["sharedInbox"].(string)
|
||||||
|
}
|
||||||
|
|
||||||
return RemoteActor{
|
return RemoteActor{
|
||||||
iri: iri,
|
iri: iri,
|
||||||
|
@ -95,5 +106,8 @@ func (ra RemoteActor) GetInbox() string {
|
||||||
|
|
||||||
// GetSharedInbox returns the inbox url of the actor
|
// GetSharedInbox returns the inbox url of the actor
|
||||||
func (ra RemoteActor) GetSharedInbox() string {
|
func (ra RemoteActor) GetSharedInbox() string {
|
||||||
|
if ra.sharedInbox == "" {
|
||||||
|
return ra.inbox
|
||||||
|
}
|
||||||
return ra.sharedInbox
|
return ra.sharedInbox
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue