优化客服云权限安全与访客IP解析
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"kefu-cloud/server/internal/config"
|
||||
"kefu-cloud/server/internal/middleware"
|
||||
@@ -33,10 +35,11 @@ func SetupRoutes(r *gin.Engine, store storage.ObjectStorage, storageCfg config.S
|
||||
api := r.Group("/api")
|
||||
|
||||
// 公开接口
|
||||
api.POST("/login", auth.Login)
|
||||
api.POST("/login", middleware.RateLimitByIP(20, time.Minute), auth.Login)
|
||||
|
||||
// widget 接口
|
||||
widgetApi := api.Group("/widget")
|
||||
widgetApi.Use(middleware.RateLimitByIP(240, time.Minute))
|
||||
widgetApi.POST("/init", widget.Init)
|
||||
widgetApi.GET("/init", widget.Init)
|
||||
widgetApi.POST("/message", widget.SendMessage)
|
||||
@@ -88,7 +91,7 @@ func SetupRoutes(r *gin.Engine, store storage.ObjectStorage, storageCfg config.S
|
||||
customers.GET("/:id", middleware.RequirePermission("customer.view"), customer.Get)
|
||||
customers.POST("", middleware.RequirePermission("customer.create"), customer.Create)
|
||||
customers.PUT("/:id", middleware.RequirePermission("customer.edit"), customer.Update)
|
||||
customers.DELETE("/:id", middleware.RequirePermission("customer.export"), customer.Delete)
|
||||
customers.DELETE("/:id", middleware.RequirePermission("customer.delete"), customer.Delete)
|
||||
|
||||
// 黑名单(拉黑 IP / 设备)
|
||||
bl := authRequired.Group("/blacklist")
|
||||
|
||||
Reference in New Issue
Block a user