diff options
Diffstat (limited to 'route')
-rw-r--r-- | route/routes/actor.go | 8 | ||||
-rw-r--r-- | route/routes/admin.go | 2 | ||||
-rw-r--r-- | route/routes/webfinger.go | 5 | ||||
-rw-r--r-- | route/util.go | 2 |
4 files changed, 6 insertions, 11 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go index 2437567..94623f0 100644 --- a/route/routes/actor.go +++ b/route/routes/actor.go @@ -43,8 +43,8 @@ func ActorInbox(ctx *fiber.Ctx) error { case "Create": for _, e := range activity.To { actor := activitypub.Actor{Id: e} - if res, err := actor.IsLocal(); err == nil && res { - if res, err := activity.Actor.IsLocal(); err == nil && res { + if local, _ := actor.IsLocal(); local { + if local, _ := activity.Actor.IsLocal(); !local { reqActivity := activitypub.Activity{Id: activity.Object.Id} col, err := reqActivity.GetCollection() if err != nil { @@ -55,7 +55,7 @@ func ActorInbox(ctx *fiber.Ctx) error { break } - if err := activity.Object.WriteCache(); err != nil { + if _, err := activity.Object.WriteCache(); err != nil { return util.MakeError(err, "ActorInbox") } @@ -69,8 +69,6 @@ func ActorInbox(ctx *fiber.Ctx) error { } //SendToFollowers(e, activity) - } else if err != nil { - return util.MakeError(err, "ActorInbox") } } else if err != nil { return util.MakeError(err, "ActorInbox") diff --git a/route/routes/admin.go b/route/routes/admin.go index 4571955..31e8e8e 100644 --- a/route/routes/admin.go +++ b/route/routes/admin.go @@ -195,7 +195,7 @@ func AdminAddBoard(ctx *fiber.Ctx) error { var nobj activitypub.ObjectBase newActorActivity.Actor = &actor - newActorActivity.Object = &nobj + newActorActivity.Object = nobj newActorActivity.Object.Alias = board.Name newActorActivity.Object.Name = board.PreferredUsername diff --git a/route/routes/webfinger.go b/route/routes/webfinger.go index 3d5fa63..9b5ae25 100644 --- a/route/routes/webfinger.go +++ b/route/routes/webfinger.go @@ -6,7 +6,6 @@ import ( "github.com/FChannel0/FChannel-Server/activitypub" "github.com/FChannel0/FChannel-Server/config" - "github.com/FChannel0/FChannel-Server/util" "github.com/gofiber/fiber/v2" ) @@ -34,11 +33,9 @@ func Webfinger(c *fiber.Ctx) error { } actor := activitypub.Actor{Id: config.TP + "" + actorDomain[1] + "" + actorDomain[0]} - if res, err := actor.IsLocal(); err == nil && !res { + if res, _ := actor.IsLocal(); !res { c.Status(fiber.StatusBadRequest) return c.Send([]byte("actor not local")) - } else if err != nil { - return util.MakeError(err, "Webfinger") } var finger activitypub.Webfinger diff --git a/route/util.go b/route/util.go index defa60e..131cf5a 100644 --- a/route/util.go +++ b/route/util.go @@ -186,7 +186,7 @@ func ParseOutboxRequest(ctx *fiber.Ctx, actor activitypub.Actor) error { return util.MakeError(err, "ParseOutboxRequest") } - if res, err := activity.IsLocal(); err == nil && res { + if res, _ := activity.IsLocal(); res { if res := activity.Actor.VerifyHeaderSignature(ctx); err == nil && !res { ctx.Response().Header.Set("Status", "403") _, err = ctx.Write([]byte("")) |