完善论坛配置与发帖体验:TipTap 富文本、图片上传、修订历史、Feed 排序与后台参数管理。
同步更新 README 与 ROADMAP,反映最新功能与开发状态。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -142,11 +142,11 @@ func respondBanned(c *gin.Context) {
|
||||
// RateLimitMiddleware 限流中间件
|
||||
func RateLimitMiddleware(limiter *service.RateLimiter, action string) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
key := c.ClientIP() + ":" + action
|
||||
key := c.ClientIP()
|
||||
if uid, ok := c.Get(CtxUserID); ok {
|
||||
key = fmt.Sprintf("%s:%d", action, uid.(uint))
|
||||
key = fmt.Sprintf("%d", uid.(uint))
|
||||
}
|
||||
if !limiter.Allow(key) {
|
||||
if !limiter.Allow(action, key) {
|
||||
c.JSON(http.StatusTooManyRequests, gin.H{"error": "操作过于频繁,请稍后再试"})
|
||||
c.Abort()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user