aboutsummaryrefslogtreecommitdiff
path: root/routes/outbox.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-08 14:57:40 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit580dec5b89215310ce34341e11ff17fe38bdb63a (patch)
tree894424df66a9d9f7e41805822f29adac8fb490fe /routes/outbox.go
parentf7bf818d29393ceaccf4d2906557351fa6a4f49f (diff)
more cleanup, logging and error logging everywhere
things are mostly in place can work on "features" and polish
Diffstat (limited to 'routes/outbox.go')
-rw-r--r--routes/outbox.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/routes/outbox.go b/routes/outbox.go
index 902d3e6..1d0d52e 100644
--- a/routes/outbox.go
+++ b/routes/outbox.go
@@ -5,7 +5,7 @@ import (
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
- "github.com/FChannel0/FChannel-Server/db"
+ "github.com/FChannel0/FChannel-Server/post"
"github.com/FChannel0/FChannel-Server/util"
"github.com/FChannel0/FChannel-Server/webfinger"
"github.com/gofiber/fiber/v2"
@@ -14,7 +14,7 @@ import (
func Outbox(ctx *fiber.Ctx) error {
actor, err := webfinger.GetActorFromPath(ctx.Path(), "/")
if err != nil {
- return err
+ return util.MakeError(err, "Outbox")
}
if activitypub.AcceptActivity(ctx.Get("Accept")) {
@@ -40,13 +40,13 @@ func OutboxGet(ctx *fiber.Ctx) error {
var page int
if postNum := ctx.Query("page"); postNum != "" {
if page, err = strconv.Atoi(postNum); err != nil {
- return err
+ return util.MakeError(err, "OutboxGet")
}
}
collection, err := actor.WantToServePage(page)
if err != nil {
- return err
+ return util.MakeError(err, "OutboxGet")
}
var offset = 15
@@ -68,7 +68,7 @@ func OutboxGet(ctx *fiber.Ctx) error {
data.Board.InReplyTo = ""
data.Board.To = actor.Outbox
data.Board.Actor = actor
- data.Board.ModCred, _ = db.GetPasswordFromSession(ctx)
+ data.Board.ModCred, _ = util.GetPasswordFromSession(ctx)
data.Board.Domain = config.Domain
data.Board.Restricted = actor.Restricted
data.CurrentPage = page
@@ -76,12 +76,12 @@ func OutboxGet(ctx *fiber.Ctx) error {
data.Board.Post.Actor = actor.Id
- capt, err := db.GetRandomCaptcha()
+ capt, err := util.GetRandomCaptcha()
if err != nil {
- return err
+ return util.MakeError(err, "OutboxGet")
}
data.Board.Captcha = config.Domain + "/" + capt
- data.Board.CaptchaCode = util.GetCaptchaCode(data.Board.Captcha)
+ data.Board.CaptchaCode = post.GetCaptchaCode(data.Board.Captcha)
data.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername