xmr-remote-nodes/handler/middlewares.go

19 lines
319 B
Go
Raw Normal View History

package handler
import (
"github.com/gofiber/fiber/v2"
)
func CookieProtected(c *fiber.Ctx) error {
cookie := c.Cookies("xmr-nodes-ui")
if cookie == "" {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"status": "error",
"message": "Unauthorized",
"data": nil,
})
}
return c.Next()
}