Compare commits

..

6 Commits

Author SHA1 Message Date
naiba
166f25508c fix: dashboard waf page 2024-11-30 21:33:18 +08:00
naiba
08f0c25dfc chore: upgrade admin frontend 2024-11-30 17:18:11 +08:00
naiba
6cca88f027 fix: admin frontend 2024-11-30 15:19:55 +08:00
naiba
f62934440d feat: 支持修改用户名 2024-11-30 15:05:46 +08:00
naiba
44aded493e chore: upgrade admin frontend 2024-11-30 13:50:46 +08:00
naiba
8b7d6be398 feat: update frontend 2024-11-30 11:46:28 +08:00
6 changed files with 17 additions and 3 deletions

View File

@ -32,7 +32,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: nezhahq/admin-frontend
tag: v1.0.4
tag: v1.0.11
fileName: dist.zip
latest: true
extract: true
@ -45,7 +45,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: nezhahq/user-frontend
tag: v1.0.3
tag: v1.0.4
fileName: dist.zip
latest: true
extract: true

View File

@ -62,6 +62,7 @@ func updateProfile(c *gin.Context) (any, error) {
return nil, err
}
user.Username = pf.NewUsername
user.Password = string(hash)
if err := singleton.DB.Save(&user).Error; err != nil {
return nil, newGormError("%v", err)

View File

@ -14,7 +14,7 @@ import (
// @Description List server
// @Tags auth required
// @Produce json
// @Success 200 {object} model.CommonResponse[[]model.WAF]
// @Success 200 {object} model.CommonResponse[[]model.WAFApiMock]
// @Router /waf [get]
func listBlockedAddress(c *gin.Context) ([]*model.WAF, error) {
var waf []*model.WAF

View File

@ -3,6 +3,7 @@ package rpc
import (
"context"
"fmt"
"log"
"net/http"
"net/netip"
"time"
@ -63,6 +64,10 @@ func getRealIp(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
}
}
if singleton.Conf.Debug {
log.Printf("NEZHA>> gRPC Real IP: %s", ip)
}
ctx = context.WithValue(ctx, model.CtxKeyRealIP{}, ip)
return handler(ctx, req)
}

View File

@ -7,5 +7,6 @@ type UserForm struct {
type ProfileForm struct {
OriginalPassword string `json:"original_password,omitempty"`
NewUsername string `json:"new_username,omitempty"`
NewPassword string `json:"new_password,omitempty"`
}

View File

@ -16,6 +16,13 @@ const (
WAFBlockReasonTypeAgentAuthFail
)
type WAFApiMock struct {
IP string `json:"ip,omitempty"`
Count uint64 `json:"count,omitempty"`
LastBlockReason uint8 `json:"last_block_reason,omitempty"`
LastBlockTimestamp uint64 `json:"last_block_timestamp,omitempty"`
}
type WAF struct {
IP []byte `gorm:"type:binary(16);primaryKey" json:"ip,omitempty"`
Count uint64 `json:"count,omitempty"`