diff options
author | KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> | 2021-11-07 00:32:39 -0300 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 972223c992ca5aa5e5d93cff3b2ee4e30182025b (patch) | |
tree | ff61695c734852aeafdc0e872cc6f47085a8e787 /webfinger/comm.go | |
parent | bc9051fd1a17e793647cf309c973a7feefebd98f (diff) |
restructuring part 5
Diffstat (limited to 'webfinger/comm.go')
-rw-r--r-- | webfinger/comm.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/webfinger/comm.go b/webfinger/comm.go index dd25cb4..35ad335 100644 --- a/webfinger/comm.go +++ b/webfinger/comm.go @@ -5,6 +5,7 @@ import ( "errors" "io/ioutil" "net/http" + "regexp" "github.com/FChannel0/FChannel-Server/activitypub" "github.com/FChannel0/FChannel-Server/config" @@ -68,3 +69,21 @@ func GetCollectionFromReq(path string) (activitypub.Collection, error) { err = json.Unmarshal(body, &respCollection) return respCollection, err } + +func GetActorsFollowFromName(actor activitypub.Actor, name string) ([]string, error) { + var followingActors []string + follow, err := GetActorCollection(actor.Following) + if err != nil { + return followingActors, err + } + + re := regexp.MustCompile("\\w+?$") + + for _, e := range follow.Items { + if re.FindString(e.Id) == name { + followingActors = append(followingActors, e.Id) + } + } + + return followingActors, nil +} |