fixed localip tracing bug with c.ClientIP()

This commit is contained in:
rawleyIfowler
2022-03-03 13:16:01 -06:00
parent a137a2fb8f
commit df4cc066f2

View File

@@ -117,7 +117,8 @@ func CreateComment(c *gin.Context) {
AssociatedPost: a[2],
}
db.Create(&comment)
recentPosters[c.ClientIP()]++
// Something was wrong with c.ClientIP() with trusted?? Weird.
recentPosters[c.Request.Header.Get("X-Forwarded-For")]++
// Pass the associated post to the template to add to the href
c.HTML(http.StatusOK, "comment_post.tmpl", CommentDto{Url: comment.AssociatedPost})
}