update profile api (#16)

* update profile api

* rename

* fix realip assertion

* add waf api
This commit is contained in:
UUBulb authored and GitHub committed 2024-11-23 16:22:22 +08:00
1 parent 6db1a4b19d
commit e465134c11
7 files changed
+85 -7

No files matched your search

+2 -1
View File
@@ -27,7 +27,8 @@ func ServeRPC() *grpc.Server {
}
func waf(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
if err := model.CheckIP(singleton.DB, ctx.Value(model.CtxKeyRealIP{}).(string)); err != nil {
realip, _ := ctx.Value(model.CtxKeyRealIP{}).(string)
if err := model.CheckIP(singleton.DB, realip); err != nil {
return nil, err
}
return handler(ctx, req)