fixing vote IP checks

This commit is contained in:
ngn 2023-11-15 19:40:36 +03:00
parent be42fa1043
commit d51712f8e7
2 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,6 @@ func AddPost(c *fiber.Ctx) error{
}
post.Date = time.Now().Format("02/01/06")
log.Println(post.Date)
post.ID = TitleToID(post.Title)
_, err := DB.Exec(

View File

@ -4,6 +4,7 @@ import (
"database/sql"
"log"
"net/http"
"strings"
"github.com/gofiber/fiber/v2"
"github.com/ngn13/website/api/util"
@ -29,7 +30,7 @@ func BlogDb(db *sql.DB) {
func GetIP(c *fiber.Ctx) string {
if c.Get("X-Real-IP") != "" {
return c.Get("X-Real-IP")
return strings.Clone(c.Get("X-Real-IP"))
}
return c.IP()