aboutsummaryrefslogtreecommitdiff
path: root/routes/archive.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-11-07 00:32:39 -0300
committerFChannel <>2022-06-19 12:53:29 -0700
commit972223c992ca5aa5e5d93cff3b2ee4e30182025b (patch)
treeff61695c734852aeafdc0e872cc6f47085a8e787 /routes/archive.go
parentbc9051fd1a17e793647cf309c973a7feefebd98f (diff)
restructuring part 5
Diffstat (limited to 'routes/archive.go')
-rw-r--r--routes/archive.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/routes/archive.go b/routes/archive.go
new file mode 100644
index 0000000..87f3b8b
--- /dev/null
+++ b/routes/archive.go
@@ -0,0 +1,53 @@
+package routes
+
+import (
+ "github.com/FChannel0/FChannel-Server/activitypub"
+ "github.com/FChannel0/FChannel-Server/config"
+ "github.com/FChannel0/FChannel-Server/db"
+ "github.com/FChannel0/FChannel-Server/util"
+ "github.com/gofiber/fiber/v2"
+)
+
+func ArchiveGet(ctx *fiber.Ctx) error {
+ // TODO
+ collection := ctx.Locals("collection").(activitypub.Collection)
+ actor := collection.Actor
+
+ var returnData PageData
+ returnData.Board.Name = actor.Name
+ returnData.Board.PrefName = actor.PreferredUsername
+ returnData.Board.InReplyTo = ""
+ returnData.Board.To = actor.Outbox
+ returnData.Board.Actor = *actor
+ returnData.Board.Summary = actor.Summary
+ returnData.Board.ModCred, _ = getPassword(ctx)
+ returnData.Board.Domain = config.Domain
+ returnData.Board.Restricted = actor.Restricted
+ returnData.Key = config.Key
+ returnData.ReturnTo = "archive"
+
+ returnData.Board.Post.Actor = actor.Id
+
+ var err error
+ returnData.Instance, err = db.GetActorFromDB(config.Domain)
+
+ 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.Boards = db.Boards
+
+ returnData.Posts = collection.OrderedItems
+
+ returnData.Themes = &config.Themes
+ returnData.ThemeCookie = getThemeCookie(ctx)
+
+ return ctx.Render("archive", fiber.Map{
+ "page": returnData,
+ }, "layouts/main")
+}