aboutsummaryrefslogtreecommitdiff
path: root/routes/outbox.go
diff options
context:
space:
mode:
authorFChannel <>2022-04-29 10:36:43 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit5b52d269faa2ce2014d0feba603a2122361cf4eb (patch)
tree0b66338d18add90ccd1d100ffe9bdb1eecc7319d /routes/outbox.go
parent3db517715bef6a53225c5c3c06e8fc5fd0bf71e3 (diff)
general layout organization
Diffstat (limited to 'routes/outbox.go')
-rw-r--r--routes/outbox.go73
1 files changed, 38 insertions, 35 deletions
diff --git a/routes/outbox.go b/routes/outbox.go
index 1277011..4b874df 100644
--- a/routes/outbox.go
+++ b/routes/outbox.go
@@ -41,36 +41,6 @@ func OutboxGet(ctx *fiber.Ctx) error {
}
}
- var returnData PageData
-
- returnData.Board.Name = actor.Name
- returnData.Board.PrefName = actor.PreferredUsername
- returnData.Board.Summary = actor.Summary
- returnData.Board.InReplyTo = ""
- returnData.Board.To = actor.Outbox
- returnData.Board.Actor = actor
- returnData.Board.ModCred, _ = getPassword(ctx)
- returnData.Board.Domain = config.Domain
- returnData.Board.Restricted = actor.Restricted
- returnData.CurrentPage = page
- returnData.ReturnTo = "feed"
-
- returnData.Board.Post.Actor = actor.Id
-
- capt, err := db.GetRandomCaptcha()
- if err != nil {
- return err
- }
- returnData.Board.Captcha = config.Domain + "/" + capt
- returnData.Board.CaptchaCode = util.GetCaptchaCode(returnData.Board.Captcha)
-
- returnData.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername
-
- returnData.Key = config.Key
-
- returnData.Boards = db.Boards
- returnData.Posts = collection.OrderedItems
-
var offset = 15
var pages []int
pageLimit := (float64(collection.TotalItems) / float64(offset))
@@ -83,13 +53,46 @@ func OutboxGet(ctx *fiber.Ctx) error {
pages = append(pages, int(i))
}
- returnData.Pages = pages
- returnData.TotalPage = len(returnData.Pages) - 1
+ var data PageData
+ data.Board.Name = actor.Name
+ data.Board.PrefName = actor.PreferredUsername
+ data.Board.Summary = actor.Summary
+ data.Board.InReplyTo = ""
+ data.Board.To = actor.Outbox
+ data.Board.Actor = actor
+ data.Board.ModCred, _ = getPassword(ctx)
+ data.Board.Domain = config.Domain
+ data.Board.Restricted = actor.Restricted
+ data.CurrentPage = page
+ data.ReturnTo = "feed"
+
+ data.Board.Post.Actor = actor.Id
+
+ capt, err := db.GetRandomCaptcha()
+ if err != nil {
+ return err
+ }
+ data.Board.Captcha = config.Domain + "/" + capt
+ data.Board.CaptchaCode = util.GetCaptchaCode(data.Board.Captcha)
+
+ data.Title = "/" + actor.Name + "/ - " + actor.PreferredUsername
+
+ data.Key = config.Key
+
+ data.Boards = db.Boards
+ data.Posts = collection.OrderedItems
+
+ data.Pages = pages
+ data.TotalPage = len(data.Pages) - 1
+
+ data.Meta.Description = data.Board.Summary
+ data.Meta.Url = data.Board.Actor.Id
+ data.Meta.Title = data.Title
- returnData.Themes = &config.Themes
- returnData.ThemeCookie = getThemeCookie(ctx)
+ data.Themes = &config.Themes
+ data.ThemeCookie = getThemeCookie(ctx)
return ctx.Render("nposts", fiber.Map{
- "page": returnData,
+ "page": data,
}, "layouts/main")
}