From 68c499b160f4acf2fcb1a77cf5804659036032fa Mon Sep 17 00:00:00 2001 From: fancl Date: Fri, 13 Dec 2024 10:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=B7=BB=E5=8A=A0User=20Agent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api.go b/api.go index 68fe929..a22862f 100644 --- a/api.go +++ b/api.go @@ -36,6 +36,8 @@ func (svr *Server) handleLogin(ctx *http.Context) (err error) { if err = ctx.Bind(req); err != nil { return ctx.Error(http.ErrInvalidPayload, err.Error()) } + req.RealIP = ctx.RealIp() + req.UserAgent = ctx.Request().Header.Get("User-Agent") if tk, err = passport.Login(ctx.Context(), req); err != nil { return ctx.Error(http.ErrPermissionDenied, err.Error()) }