More logging
This commit is contained in:
parent
d8f2708c3d
commit
3e5e8a99c3
14
actor.go
14
actor.go
|
@ -223,14 +223,16 @@ func (a *Actor) newID() (hash string, url string) {
|
||||||
func (a *Actor) Accept(follow map[string]interface{}) {
|
func (a *Actor) Accept(follow map[string]interface{}) {
|
||||||
// it's a follow, write it down
|
// it's a follow, write it down
|
||||||
newFollower := follow["actor"].(string)
|
newFollower := follow["actor"].(string)
|
||||||
|
fmt.Println("New follow request:", newFollower)
|
||||||
// check we aren't following ourselves
|
// check we aren't following ourselves
|
||||||
if newFollower == follow["object"] {
|
if newFollower == follow["object"] {
|
||||||
// actor and object are equal
|
// actor and object are equal
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
follower, err := NewRemoteActor(follow["actor"].(string))
|
follower, err := NewRemoteActor(newFollower)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Couldn't retrieve remote actor info
|
// Couldn't retrieve remote actor info
|
||||||
|
fmt.Println("Failed to retrieve remote actor info:", newFollower)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Add or update follower
|
// Add or update follower
|
||||||
|
@ -244,5 +246,13 @@ func (a *Actor) Accept(follow map[string]interface{}) {
|
||||||
accept["actor"] = a.iri
|
accept["actor"] = a.iri
|
||||||
accept["object"] = follow
|
accept["object"] = follow
|
||||||
accept["type"] = "Accept"
|
accept["type"] = "Accept"
|
||||||
go func() { _ = a.signedHTTPPost(accept, follower.inbox) }()
|
go func() {
|
||||||
|
err = a.signedHTTPPost(accept, follower.inbox)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Failed to accept:", follower.iri)
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
} else {
|
||||||
|
fmt.Println("Accepted:", follower.iri)
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue