2026-02-20 23:22:10 +00:00
|
|
|
package middleware
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"log"
|
|
|
|
|
|
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
|
|
|
"lmika.dev/lmika/weiro/models"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func AuthUser() func(c fiber.Ctx) error {
|
|
|
|
|
return func(c fiber.Ctx) error {
|
|
|
|
|
// TEMP - Actually do the auth here
|
|
|
|
|
user := models.User{
|
|
|
|
|
ID: 1,
|
|
|
|
|
Username: "testuser",
|
2026-02-24 11:21:26 +00:00
|
|
|
TimeZone: "Australia/Melbourne",
|
2026-02-20 23:22:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c.Locals("user", user)
|
|
|
|
|
c.SetContext(models.WithUser(c.Context(), user))
|
|
|
|
|
log.Printf("User %s authenticated", user.Username)
|
|
|
|
|
|
|
|
|
|
return c.Next()
|
|
|
|
|
}
|
|
|
|
|
}
|