aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-11-07 00:59:12 -0300
committerFChannel <>2022-06-19 12:53:29 -0700
commit7116705959bad9244893434039a0da9b500f5043 (patch)
tree54fd00840cbcfc9907d37b3bfb376fde87f48bb1 /routes
parent972223c992ca5aa5e5d93cff3b2ee4e30182025b (diff)
last commit of the night
Diffstat (limited to 'routes')
-rw-r--r--routes/post.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/routes/post.go b/routes/post.go
index 41706c0..ace9c6b 100644
--- a/routes/post.go
+++ b/routes/post.go
@@ -3,6 +3,7 @@ package routes
import (
"regexp"
+ "github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
"github.com/FChannel0/FChannel-Server/db"
"github.com/FChannel0/FChannel-Server/util"
@@ -102,3 +103,65 @@ func PostGet(ctx *fiber.Ctx) error {
"page": returnData,
}, "layouts/main")
}
+
+func CatalogGet(ctx *fiber.Ctx) error {
+ // TODO:
+ collection := ctx.Locals("collection").(activitypub.Collection)
+
+ // TODO: implement this in template functions
+ // "showArchive": func() bool {
+ // col, err := db.GetActorCollectionDBTypeLimit(collection.Actor.Id, "Archive", 1)
+ // if err != nil {
+ // // TODO: figure out what to do here
+ // panic(err)
+ // }
+ //
+ // if len(col.OrderedItems) > 0 {
+ // return true
+ // }
+ // return false
+ //},
+
+ 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 = "catalog"
+
+ returnData.Board.Post.Actor = actor.Id
+
+ var err error
+ returnData.Instance, err = db.GetActorFromDB(config.Domain)
+ if err != nil {
+ return err
+ }
+
+ 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("ncatalog", fiber.Map{
+ "page": returnData,
+ }, "layouts/main")
+}