2022-10-14 09:15:43 +00:00
|
|
|
package middleware
|
|
|
|
|
2023-02-17 15:36:54 +00:00
|
|
|
import (
|
2023-05-04 12:36:17 +00:00
|
|
|
"github.com/fthvgb1/wp-go/app/cmd/reload"
|
|
|
|
"github.com/fthvgb1/wp-go/app/pkg/config"
|
2023-02-17 15:36:54 +00:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
2022-10-14 09:15:43 +00:00
|
|
|
|
2023-02-17 15:36:54 +00:00
|
|
|
func SearchLimit(num int64) func(ctx *gin.Context) {
|
2022-11-16 03:09:25 +00:00
|
|
|
fn, reFn := IpLimit(num)
|
2023-02-17 15:36:54 +00:00
|
|
|
reload.Push(func() {
|
|
|
|
reFn(config.GetConfig().SingleIpSearchNum)
|
|
|
|
})
|
2022-10-14 09:15:43 +00:00
|
|
|
return func(c *gin.Context) {
|
2022-10-17 12:04:29 +00:00
|
|
|
if c.Query("s") != "" {
|
2022-10-14 09:15:43 +00:00
|
|
|
fn(c)
|
|
|
|
} else {
|
|
|
|
c.Next()
|
|
|
|
}
|
|
|
|
|
2023-02-17 15:36:54 +00:00
|
|
|
}
|
2022-10-14 09:15:43 +00:00
|
|
|
}
|