aboutsummaryrefslogtreecommitdiff
path: root/controllers/pages.go
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/pages.go')
-rw-r--r--controllers/pages.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/controllers/pages.go b/controllers/pages.go
index fd87570..cb1b82b 100644
--- a/controllers/pages.go
+++ b/controllers/pages.go
@@ -5,9 +5,11 @@ import (
"paperchan.club/models"
"github.com/gofiber/fiber/v2"
"log"
+ "math/rand"
)
const maxThreadsPerPage = 24
+const maxBanner = 12 // dont forget to increment whenever we add more
func ThreadList(c *fiber.Ctx) error {
db := database.DB
@@ -35,6 +37,7 @@ func ThreadList(c *fiber.Ctx) error {
return c.Render("index", fiber.Map{
"posts": threads,
"pages": pages,
+ "banner": rand.Intn(maxBanner)+1,
})
}
@@ -49,5 +52,6 @@ func Thread(c *fiber.Ctx) error {
return c.Render("thread", fiber.Map{
"threadId": id,
"posts": posts,
+ "banner": rand.Intn(maxBanner)+1,
})
}