From 5a5c1ae8c38cb335f600590990e9ba4712a907ee Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sat, 26 Apr 2025 11:40:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E8=BF=9B=E8=A1=8C=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/tool.go | 8 ++++++-- proto/conf.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/handler/tool.go b/handler/tool.go index d33dd1b..7387b6c 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -59,6 +59,7 @@ func SetUpToolGroup(router *gin.Engine) { toolGroup.GET("/qq_auth", GetQQAuthUrl) toolGroup.GET("/github_auth", ToGithubAuthPage) toolGroup.POST("/github_callback", handleGithubCallback) + toolGroup.POST("/loginRedirect", LoginRedirect) //发送邮件 toolGroup.POST("/send_mail", SendMailTool) toolGroup.POST("/dashboard", DashBoardStatistics) @@ -127,7 +128,7 @@ func GetQQAuthUrl(c *gin.Context) { params.Add("response_type", "code") params.Add("client_id", worker.AppId) params.Add("state", "saw_"+hType+"_"+uuid) - str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), worker.RedirectURI) + str := fmt.Sprintf("%s", params.Encode()) loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/authorize", str) //c.Redirect(http.StatusFound, loginURL) //重定向到QQ登录页面 resp.Message = "success" @@ -659,7 +660,6 @@ func ToGithubAuthPage(c *gin.Context) { params.Add("state", "saw_"+hType+"_"+uuid) baseUri := "https://github.com/login/oauth/authorize" redirectUrl := fmt.Sprintf("%s?%s", baseUri, params.Encode()) - redirectUrl = fmt.Sprintf("%s&redirect_uri=%s", redirectUrl, "https://sv.ljsea.top") //c.Redirect(http.StatusFound, redirectUrl) resp.Message = "success" resp.Code = proto.SuccessCode @@ -667,3 +667,7 @@ func ToGithubAuthPage(c *gin.Context) { c.JSON(http.StatusOK, resp) } + +func LoginRedirect(c *gin.Context) { + c.Redirect(http.StatusFound, "https://sv.ljsea.top/") //重定向到登录页面 +} diff --git a/proto/conf.go b/proto/conf.go index 6bb07a8..a9eee59 100644 --- a/proto/conf.go +++ b/proto/conf.go @@ -9,7 +9,7 @@ import ( var Config ConfigStruct var SigningKey = []byte{} -var Url_map = map[string]bool{"/login": true, "/register": true, "/uuid": true, "/gqr": true, "/cid/callback": true, "/tool/monitor": true, "/user/sync": true, "/tool/file/": true, "/user/reset": true, "/tool/qq_auth": true, "/tool/qq_callback": true, "/tool/github_auth": true, "/tool/github_callback": true, "/user/oAuth": true, "/user/oAuth_uuid": true} // 不需要token验证的url +var Url_map = map[string]bool{"/login": true, "/register": true, "/uuid": true, "/gqr": true, "/cid/callback": true, "/tool/monitor": true, "/user/sync": true, "/tool/file/": true, "/user/reset": true, "/tool/qq_auth": true, "/tool/qq_callback": true, "/tool/github_auth": true, "/tool/github_callback": true, "/user/oAuth": true, "/user/oAuth_uuid": true, "/tool/loginRedirect": true} // 不需要token验证的url var Per_menu_map = map[string]int{"/video/": 1, "/device/": 2, "/cid/": 3} var File_Type = map[string]int{"im": 1, "avatar": 2, "file": 3, "config": 4} // 文件类型 const (