不进行重定向

This commit is contained in:
junleea 2025-04-26 11:40:19 +08:00
parent fc30a92ca4
commit 5a5c1ae8c3
2 changed files with 7 additions and 3 deletions

View File

@ -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/") //重定向到登录页面
}

View File

@ -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 (