feat: 发评限流与品牌 Logo/Favicon/OG 上传

发评挂 RateLimiter comment;设置页支持品牌图上传/清除,并写入 favicon 与 og:image。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-30 04:06:48 +08:00
parent 4ffcaecba2
commit 118f967540
13 changed files with 255 additions and 58 deletions

View File

@@ -391,6 +391,11 @@ func (d Deps) PostComment(c *gin.Context) {
}
}
isPrivate := c.PostForm("is_private") == "1" || c.PostForm("is_private") == "on"
if d.Limiter != nil && !d.Limiter.Allow("comment", fmt.Sprintf("%d", ctx.UserID())) {
ctx.SetFlash("操作过于频繁,请稍后再试")
ctx.Redirect(fmt.Sprintf("/post/%d#comments", id))
return
}
safe := "<p>" + html.EscapeString(content) + "</p>"
cm, err := d.Comment.Create(services.CommentCreateInput{
PostID: id, UserID: ctx.UserID(), Content: safe,