From f7bf818d29393ceaccf4d2906557351fa6a4f49f Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 7 May 2022 21:21:38 -0700 Subject: added error func and general cleanup/organization --- routes/actor.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'routes/actor.go') 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) } } -- cgit v1.2.3