mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
feat: upgrade frontend
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Contributors / contributors (push) Has been cancelled
Sync / sync-to-jihulab (push) Has been cancelled
Run Tests / tests (macos) (push) Has been cancelled
Run Tests / tests (ubuntu) (push) Has been cancelled
Run Tests / tests (windows) (push) Has been cancelled
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Contributors / contributors (push) Has been cancelled
Sync / sync-to-jihulab (push) Has been cancelled
Run Tests / tests (macos) (push) Has been cancelled
Run Tests / tests (ubuntu) (push) Has been cancelled
Run Tests / tests (windows) (push) Has been cancelled
This commit is contained in:
parent
7d15838548
commit
87e01a532e
@ -101,8 +101,8 @@ func authenticator() func(c *gin.Context) (interface{}, error) {
|
|||||||
return nil, jwt.ErrFailedAuthentication
|
return nil, jwt.ErrFailedAuthentication
|
||||||
}
|
}
|
||||||
|
|
||||||
model.ClearIP(singleton.DB, realip, model.BlockIDUnknownUser)
|
model.UnblockIP(singleton.DB, realip, model.BlockIDUnknownUser)
|
||||||
model.ClearIP(singleton.DB, realip, int64(user.ID))
|
model.UnblockIP(singleton.DB, realip, int64(user.ID))
|
||||||
return utils.Itoa(user.ID), nil
|
return utils.Itoa(user.ID), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ func optionalAuthMiddleware(mw *jwt.GinJWTMiddleware) func(c *gin.Context) {
|
|||||||
identity := mw.IdentityHandler(c)
|
identity := mw.IdentityHandler(c)
|
||||||
|
|
||||||
if identity != nil {
|
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)
|
c.Set(mw.IdentityKey, identity)
|
||||||
} else {
|
} else {
|
||||||
if err := model.BlockIP(singleton.DB, c.GetString(model.CtxKeyRealIPStr), model.WAFBlockReasonTypeBruteForceToken, model.BlockIDToken); err != nil {
|
if err := model.BlockIP(singleton.DB, c.GetString(model.CtxKeyRealIPStr), model.WAFBlockReasonTypeBruteForceToken, model.BlockIDToken); err != nil {
|
||||||
|
@ -69,7 +69,7 @@ func batchDeleteBlockedAddress(c *gin.Context) (any, error) {
|
|||||||
return nil, err
|
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)
|
return nil, newGormError("%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func CheckIP(db *gorm.DB, ip string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ClearIP(db *gorm.DB, ip string, uid int64) error {
|
func UnblockIP(db *gorm.DB, ip string, uid int64) error {
|
||||||
if ip == "" {
|
if ip == "" {
|
||||||
return nil
|
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
|
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 {
|
if len(ip) < 1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func (a *authHandler) Check(ctx context.Context) (uint64, error) {
|
|||||||
}
|
}
|
||||||
singleton.UserLock.RUnlock()
|
singleton.UserLock.RUnlock()
|
||||||
|
|
||||||
model.ClearIP(singleton.DB, ip, model.BlockIDgRPC)
|
model.UnblockIP(singleton.DB, ip, model.BlockIDgRPC)
|
||||||
|
|
||||||
var clientUUID string
|
var clientUUID string
|
||||||
if value, ok := md["client_uuid"]; ok {
|
if value, ok := md["client_uuid"]; ok {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
name: "OfficialAdmin"
|
name: "OfficialAdmin"
|
||||||
repository: "https://github.com/nezhahq/admin-frontend"
|
repository: "https://github.com/nezhahq/admin-frontend"
|
||||||
author: "nezhahq"
|
author: "nezhahq"
|
||||||
version: "v1.4.2"
|
version: "v1.4.3"
|
||||||
isadmin: true
|
isadmin: true
|
||||||
isofficial: true
|
isofficial: true
|
||||||
- path: "user-dist"
|
- path: "user-dist"
|
||||||
name: "Official"
|
name: "Official"
|
||||||
repository: "https://github.com/hamster1963/nezha-dash-v1"
|
repository: "https://github.com/hamster1963/nezha-dash-v1"
|
||||||
author: "hamster1963"
|
author: "hamster1963"
|
||||||
version: "v1.8.1"
|
version: "v1.9.3"
|
||||||
isofficial: true
|
isofficial: true
|
||||||
- path: "nazhua-dist"
|
- path: "nazhua-dist"
|
||||||
name: "Nazhua"
|
name: "Nazhua"
|
||||||
|
Loading…
Reference in New Issue
Block a user