Skip to content

Commit

Permalink
feat: upgrade frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Dec 25, 2024
1 parent 7d15838 commit 87e01a5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cmd/dashboard/controller/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/dashboard/controller/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions model/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion service/rpc/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions service/singleton/frontend-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 87e01a5

Please sign in to comment.