diff options
author | FChannel <> | 2022-05-07 21:21:38 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | f7bf818d29393ceaccf4d2906557351fa6a4f49f (patch) | |
tree | 723e542c8cf0db1e7e64923718977138db77b58d /routes/actor.go | |
parent | 3c5eebf6275e6d202f8a7b7f027aabcda5c1f332 (diff) |
added error func and general cleanup/organization
Diffstat (limited to 'routes/actor.go')
-rw-r--r-- | routes/actor.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/routes/actor.go b/routes/actor.go index 86a5fb9..81f6dbe 100644 --- a/routes/actor.go +++ b/routes/actor.go @@ -34,15 +34,16 @@ func ActorInbox(ctx *fiber.Ctx) error { } if !db.VerifyHeaderSignature(ctx, *activity.Actor) { - response := activitypub.RejectActivity(activity) + response := activity.Reject() return db.MakeActivityRequest(response) } switch activity.Type { case "Create": for _, e := range activity.To { - if res, err := activitypub.IsActorLocal(e); err == nil && res { - if res, err := activitypub.IsActorLocal(activity.Actor.Id); err == nil && res { + actor := activitypub.Actor{Id: e} + if res, err := actor.IsLocal(); err == nil && res { + if res, err := activity.Actor.IsLocal(); err == nil && res { col, err := activity.Object.GetCollection() if err != nil { return err @@ -107,7 +108,7 @@ func ActorInbox(ctx *fiber.Ctx) error { for _, e := range activity.To { if res, err := activitypub.GetActorFromDB(e); err == nil && res.Id != "" { response := db.AcceptFollow(activity) - response, err := activitypub.SetActorFollowerDB(response) + response, err := response.SetFollower() if err != nil { return err } @@ -168,7 +169,7 @@ func ActorInbox(ctx *fiber.Ctx) error { return err } else { fmt.Println("follow request for rejected") - response := activitypub.RejectActivity(activity) + response := activity.Reject() return db.MakeActivityRequest(response) } } |