linstrom/ap/getRemoteUser.go
2024-08-28 17:20:38 +02:00

27 lines
548 B
Go

package ap
import (
"net/http"
"gitlab.com/mstarongitlab/goap"
)
func GetRemoteUser(fullHandle string) (goap.BaseApChain, error) {
webfinger, err := GetAccountWebfinger(fullHandle)
if err != nil {
return nil, err
}
apUrl := ""
for _, link := range webfinger.Links {
if link.Relation == "self" {
apUrl = *link.Href
}
}
apRequest, err := http.NewRequest("GET", apUrl, nil)
if err != nil {
return nil, err
}
apRequest.Header.Add("Accept", "application/activity+json,application/ld+json,application/json")
return nil, nil
}