From 5ee6d0a7bb85d7f28fe4f838150c17ecb6a9d1b7 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 4 Jun 2022 15:34:45 -0700 Subject: last few routes marked TODO should be done with them this weekend and all things `should` be working for the fiber transition. still have to test federation locally --- main.go | 4 ++-- route/routes/admin.go | 12 ------------ route/routes/api.go | 8 ++++---- route/routes/boardmgmt.go | 5 +++++ route/routes/news.go | 16 +++++++++++++--- views/partials/post_nav.html | 2 +- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/main.go b/main.go index 7e25243..aa2faf7 100644 --- a/main.go +++ b/main.go @@ -63,8 +63,8 @@ func main() { app.All("/"+config.Key+"/", routes.AdminIndex) app.Get("/"+config.Key+"/follow", routes.AdminFollow) app.Post("/"+config.Key+"/addboard", routes.AdminAddBoard) - app.Get("/"+config.Key+"/postnews", routes.AdminPostNews) - app.Get("/"+config.Key+"/newsdelete", routes.AdminNewsDelete) + app.Get("/"+config.Key+"/newspost", routes.NewsPost) + app.Get("/"+config.Key+"/newsdelete", routes.NewsDelete) app.All("/"+config.Key+"/:actor/follow", routes.AdminFollow) app.Get("/"+config.Key+"/:actor", routes.AdminActorIndex) diff --git a/route/routes/admin.go b/route/routes/admin.go index dfa7313..c092b84 100644 --- a/route/routes/admin.go +++ b/route/routes/admin.go @@ -205,18 +205,6 @@ func AdminAddBoard(ctx *fiber.Ctx) error { return ctx.Redirect("/"+config.Key, http.StatusSeeOther) } -func AdminPostNews(c *fiber.Ctx) error { - // STUB - - return c.SendString("admin post news") -} - -func AdminNewsDelete(c *fiber.Ctx) error { - // STUB - - return c.SendString("admin news delete") -} - func AdminActorIndex(ctx *fiber.Ctx) error { actor, _ := webfinger.GetActorFromPath(ctx.Path(), "/"+config.Key+"/") diff --git a/route/routes/api.go b/route/routes/api.go index 080d88d..49c2623 100644 --- a/route/routes/api.go +++ b/route/routes/api.go @@ -10,12 +10,12 @@ import ( "github.com/gofiber/fiber/v2" ) -func Media(c *fiber.Ctx) error { - if c.Query("hash") != "" { - return RouteImages(c, c.Query("hash")) +func Media(ctx *fiber.Ctx) error { + if ctx.Query("hash") != "" { + return RouteImages(ctx, ctx.Query("hash")) } - return c.SendStatus(404) + return ctx.SendStatus(404) } func RouteImages(ctx *fiber.Ctx, media string) error { diff --git a/route/routes/boardmgmt.go b/route/routes/boardmgmt.go index 368e5d1..0498c5b 100644 --- a/route/routes/boardmgmt.go +++ b/route/routes/boardmgmt.go @@ -331,22 +331,27 @@ func BoardMarkSensitive(ctx *fiber.Ctx) error { return ctx.Redirect("/"+board, http.StatusSeeOther) } +// TODO routes/BoardRemove func BoardRemove(ctx *fiber.Ctx) error { return ctx.SendString("board remove") } +// TODO routes/BoardAddToIndex func BoardAddToIndex(ctx *fiber.Ctx) error { return ctx.SendString("board add to index") } +// TODO routes/BoardPopArchive func BoardPopArchive(ctx *fiber.Ctx) error { return ctx.SendString("board pop archive") } +// TODO routes/BoardAutoSubscribe func BoardAutoSubscribe(ctx *fiber.Ctx) error { return ctx.SendString("board auto subscribe") } +// TODO routes/BoardBlacklist func BoardBlacklist(ctx *fiber.Ctx) error { return ctx.SendString("board blacklist") } diff --git a/route/routes/news.go b/route/routes/news.go index 0d226a5..14de52e 100644 --- a/route/routes/news.go +++ b/route/routes/news.go @@ -43,10 +43,10 @@ func NewsGet(ctx *fiber.Ctx) error { return ctx.Render("news", fiber.Map{"page": data}, "layouts/main") } -func AllNewsGet(ctx *fiber.Ctx) error { +func NewsGetAll(ctx *fiber.Ctx) error { actor, err := activitypub.GetActorFromDB(config.Domain) if err != nil { - return util.MakeError(err, "AllNewsGet") + return util.MakeError(err, "NewsGetAll") } var data route.PageData @@ -63,7 +63,7 @@ func AllNewsGet(ctx *fiber.Ctx) error { data.NewsItems, err = db.GetNews(0) if err != nil { - return util.MakeError(err, "AllNewsGet") + return util.MakeError(err, "NewsGetAll") } data.Themes = &config.Themes @@ -71,3 +71,13 @@ func AllNewsGet(ctx *fiber.Ctx) error { return ctx.Render("anews", fiber.Map{"page": data}, "layouts/main") } + +// TODO routes/NewsPost +func NewsPost(c *fiber.Ctx) error { + return c.SendString("admin post news") +} + +// TODO routes/NewsDelete +func NewsDelete(c *fiber.Ctx) error { + return c.SendString("admin news delete") +} diff --git a/views/partials/post_nav.html b/views/partials/post_nav.html index d999c35..1b5075b 100644 --- a/views/partials/post_nav.html +++ b/views/partials/post_nav.html @@ -1,7 +1,7 @@ {{ if ne .ReturnTo "catalog" }}