xmr-remote-nodes/handler/middlewares.go

18 lines
319 B
Go

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()
}