Use person generation
This commit is contained in:
parent
9f016d3673
commit
d43c4ba739
|
@ -5,6 +5,7 @@ package activitypub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -108,11 +109,26 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
// get_person_by_rest
|
// get_person_by_rest
|
||||||
bytes := []byte{0} // no body needed for getting user actor
|
bytes := []byte{0} // no body needed for getting user actor
|
||||||
target := opt.Actor.GetID().String() // target is the person actor that originally performed the star activity
|
target := opt.Actor.GetID().String() // target is the person actor that originally performed the star activity
|
||||||
response, err := client.Get(bytes, target)
|
response, err := client.Get(bytes, target) // ToDo: Close body, maybe use in extra function
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer response.Body.Close()
|
||||||
|
body, err := io.ReadAll(response.Body)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse resonse
|
||||||
|
person, err := forgefed.ParsePersonJson(body)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("target: %v", target)
|
log.Info("target: %v", target)
|
||||||
log.Info("http client. %v", client)
|
log.Info("http client. %v", client)
|
||||||
log.Info("response: %v\n error: ", response, err)
|
log.Info("response: %v\n error: ", response, err)
|
||||||
|
log.Info("Person is: %v", person)
|
||||||
|
|
||||||
// create_user_from_person (if not alreaydy present)
|
// create_user_from_person (if not alreaydy present)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue