package controllers

import (
	"net/http"

	"gitea.tbdevent.eu/TBD/reforger_crawler_main/initializers"
	"github.com/gin-gonic/gin"
)

func CheckAllowed(c *gin.Context) {
	secret := c.GetHeader("X-SECRET-KEY")
	if secret != initializers.SECRET {
		c.JSON(http.StatusForbidden, gin.H{"error": "Forbidden"})
		c.Abort()
		return
	}
}

func CheckAdmin(c *gin.Context) {
	adminSecret := c.GetHeader("X-ADMIN-KEY")
	if adminSecret != initializers.ADMIN_SECRET {
		c.JSON(http.StatusForbidden, gin.H{"error": "Forbidden"})
		c.Abort()
		return
	}
}
