aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-11-19 20:52:13 -0400
committerFChannel <>2022-06-19 12:53:29 -0700
commit363952bfdbae19758e0241e438b95da65d084331 (patch)
tree3a47305072cfd7ba5246ba19a8ed8dbbb0bf7508
parent0a90446114512da05273e2c53b8c6fe5303a824e (diff)
will deal with view later
-rw-r--r--main.go3
-rw-r--r--routes/actor.go12
-rw-r--r--routes/post.go15
3 files changed, 10 insertions, 20 deletions
diff --git a/main.go b/main.go
index b7c0c38..3049d71 100644
--- a/main.go
+++ b/main.go
@@ -132,8 +132,9 @@ func main() {
*/
app.Get("/:actor", routes.OutboxGet)
+ app.Get("/:actor/catalog", routes.CatalogGet)
- app.Get("/:actor/:post", routes.ActorPostGet)
+ app.Get("/:actor/:post", routes.PostGet)
app.Get("/post", routes.ActorPost)
app.Get("/:actor/inbox", routes.ActorInbox)
diff --git a/routes/actor.go b/routes/actor.go
index d54b530..f107ed7 100644
--- a/routes/actor.go
+++ b/routes/actor.go
@@ -2,18 +2,6 @@ package routes
import "github.com/gofiber/fiber/v2"
-func ActorIndex(c *fiber.Ctx) error {
- // STUB
- // TODO: OutboxGet, already implemented
- return c.SendString("actor index")
-}
-
-func ActorPostGet(c *fiber.Ctx) error {
- // STUB
- // TODO: PostGet
- return c.SendString("actor post get")
-}
-
func ActorInbox(c *fiber.Ctx) error {
// STUB
diff --git a/routes/post.go b/routes/post.go
index ace9c6b..24dbbc3 100644
--- a/routes/post.go
+++ b/routes/post.go
@@ -3,7 +3,6 @@ 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"
@@ -105,8 +104,13 @@ func PostGet(ctx *fiber.Ctx) error {
}
func CatalogGet(ctx *fiber.Ctx) error {
- // TODO:
- collection := ctx.Locals("collection").(activitypub.Collection)
+ actorName := ctx.Params("actor")
+ actor, err := db.GetActorByNameFromDB(actorName)
+ if err != nil {
+ return err
+ }
+
+ collection, err := db.GetObjectFromDBCatalog(actor.Id)
// TODO: implement this in template functions
// "showArchive": func() bool {
@@ -122,14 +126,12 @@ func CatalogGet(ctx *fiber.Ctx) error {
// 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.Actor = actor
returnData.Board.Summary = actor.Summary
returnData.Board.ModCred, _ = getPassword(ctx)
returnData.Board.Domain = config.Domain
@@ -139,7 +141,6 @@ func CatalogGet(ctx *fiber.Ctx) error {
returnData.Board.Post.Actor = actor.Id
- var err error
returnData.Instance, err = db.GetActorFromDB(config.Domain)
if err != nil {
return err