diff --git a/cmd/dashboard/controller/jwt.go b/cmd/dashboard/controller/jwt.go index 72a261ea76..f1e217bd4c 100644 --- a/cmd/dashboard/controller/jwt.go +++ b/cmd/dashboard/controller/jwt.go @@ -101,8 +101,8 @@ func authenticator() func(c *gin.Context) (interface{}, error) { return nil, jwt.ErrFailedAuthentication } - model.ClearIP(singleton.DB, realip, model.BlockIDUnknownUser) - model.ClearIP(singleton.DB, realip, int64(user.ID)) + model.UnblockIP(singleton.DB, realip, model.BlockIDUnknownUser) + model.UnblockIP(singleton.DB, realip, int64(user.ID)) return utils.Itoa(user.ID), nil } } @@ -172,7 +172,7 @@ func optionalAuthMiddleware(mw *jwt.GinJWTMiddleware) func(c *gin.Context) { identity := mw.IdentityHandler(c) if identity != nil { - model.ClearIP(singleton.DB, c.GetString(model.CtxKeyRealIPStr), model.BlockIDToken) + model.UnblockIP(singleton.DB, c.GetString(model.CtxKeyRealIPStr), model.BlockIDToken) c.Set(mw.IdentityKey, identity) } else { if err := model.BlockIP(singleton.DB, c.GetString(model.CtxKeyRealIPStr), model.WAFBlockReasonTypeBruteForceToken, model.BlockIDToken); err != nil { diff --git a/cmd/dashboard/controller/waf.go b/cmd/dashboard/controller/waf.go index 88d04f96c8..91eb389281 100644 --- a/cmd/dashboard/controller/waf.go +++ b/cmd/dashboard/controller/waf.go @@ -69,7 +69,7 @@ func batchDeleteBlockedAddress(c *gin.Context) (any, error) { return nil, err } - if err := model.BatchClearIP(singleton.DB, utils.Unique(list)); err != nil { + if err := model.BatchUnblockIP(singleton.DB, utils.Unique(list)); err != nil { return nil, newGormError("%v", err) } diff --git a/model/waf.go b/model/waf.go index 75e77e87cc..2567c6a692 100644 --- a/model/waf.go +++ b/model/waf.go @@ -76,7 +76,7 @@ func CheckIP(db *gorm.DB, ip string) error { return nil } -func ClearIP(db *gorm.DB, ip string, uid int64) error { +func UnblockIP(db *gorm.DB, ip string, uid int64) error { if ip == "" { return nil } @@ -87,7 +87,7 @@ func ClearIP(db *gorm.DB, ip string, uid int64) error { return db.Unscoped().Delete(&WAF{}, "ip = ? and block_identifier = ?", ipBinary, uid).Error } -func BatchClearIP(db *gorm.DB, ip []string) error { +func BatchUnblockIP(db *gorm.DB, ip []string) error { if len(ip) < 1 { return nil } diff --git a/service/rpc/auth.go b/service/rpc/auth.go index 435b615561..d91bf6d2b9 100644 --- a/service/rpc/auth.go +++ b/service/rpc/auth.go @@ -45,7 +45,7 @@ func (a *authHandler) Check(ctx context.Context) (uint64, error) { } singleton.UserLock.RUnlock() - model.ClearIP(singleton.DB, ip, model.BlockIDgRPC) + model.UnblockIP(singleton.DB, ip, model.BlockIDgRPC) var clientUUID string if value, ok := md["client_uuid"]; ok { diff --git a/service/singleton/frontend-templates.yaml b/service/singleton/frontend-templates.yaml index 1028a50bfc..838dcd5b2d 100644 --- a/service/singleton/frontend-templates.yaml +++ b/service/singleton/frontend-templates.yaml @@ -2,14 +2,14 @@ name: "OfficialAdmin" repository: "https://github.com/nezhahq/admin-frontend" author: "nezhahq" - version: "v1.4.2" + version: "v1.4.3" isadmin: true isofficial: true - path: "user-dist" name: "Official" repository: "https://github.com/hamster1963/nezha-dash-v1" author: "hamster1963" - version: "v1.8.1" + version: "v1.9.3" isofficial: true - path: "nazhua-dist" name: "Nazhua"