aboutsummaryrefslogtreecommitdiff
path: root/routes/outbox.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-07 21:21:38 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commitf7bf818d29393ceaccf4d2906557351fa6a4f49f (patch)
tree723e542c8cf0db1e7e64923718977138db77b58d /routes/outbox.go
parent3c5eebf6275e6d202f8a7b7f027aabcda5c1f332 (diff)
added error func and general cleanup/organization
Diffstat (limited to 'routes/outbox.go')
-rw-r--r--routes/outbox.go25
1 files changed, 11 insertions, 14 deletions
diff --git a/routes/outbox.go b/routes/outbox.go
index b2ffb42..902d3e6 100644
--- a/routes/outbox.go
+++ b/routes/outbox.go
@@ -12,7 +12,6 @@ import (
)
func Outbox(ctx *fiber.Ctx) error {
-
actor, err := webfinger.GetActorFromPath(ctx.Path(), "/")
if err != nil {
return err
@@ -27,31 +26,29 @@ func Outbox(ctx *fiber.Ctx) error {
}
func OutboxGet(ctx *fiber.Ctx) error {
+ actor, err := activitypub.GetActorByNameFromDB(ctx.Params("actor"))
- actor, _ := activitypub.GetActorByNameFromDB(ctx.Params("actor"))
+ if err != nil {
+ return nil
+ }
if activitypub.AcceptActivity(ctx.Get("Accept")) {
actor.GetInfoResp(ctx)
return nil
}
- collection, valid, err := wantToServePage(ctx.Params("actor"), 0)
- if err != nil {
- return err
- } else if !valid {
- // TODO: 404 template
- return ctx.SendString("404")
- }
-
var page int
- postNum := ctx.Query("page")
- if postNum != "" {
- page, err = strconv.Atoi(postNum)
- if err != nil {
+ if postNum := ctx.Query("page"); postNum != "" {
+ if page, err = strconv.Atoi(postNum); err != nil {
return err
}
}
+ collection, err := actor.WantToServePage(page)
+ if err != nil {
+ return err
+ }
+
var offset = 15
var pages []int
pageLimit := (float64(collection.TotalItems) / float64(offset))