Go: refactor (#17635)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-31 17:48:35 +08:00
committed by GitHub
parent 36ae39bc60
commit 165a5db07d
6 changed files with 19 additions and 14 deletions

View File

@@ -175,19 +175,9 @@ func (r *Router) Setup(engine *gin.Engine) {
// searchbots
apiNoAuth.GET("/searchbots/detail", r.searchBotHandler.SearchBotDetail)
// User login channels endpoint
apiNoAuth.GET("/auth/login/channels", r.userHandler.GetLoginChannels)
// User login by email endpoint
apiNoAuth.POST("/auth/login", r.userHandler.LoginByEmail)
// OAuth / OIDC login routes. The static "channels" segment is
// registered before the wildcard, so gin's tree resolves
// /auth/login/channels to GetLoginChannels and other values to
// OAuthLogin without conflict.
apiNoAuth.GET("/auth/login/:channel", r.userHandler.OAuthLogin)
apiNoAuth.GET("/auth/oauth/:channel/callback", r.userHandler.OAuthChannelCallback)
// Register
apiNoAuth.POST("/users", r.userHandler.Register)

View File

@@ -25,6 +25,9 @@ func SetupEERouter(engine *gin.Engine) {
func RegisterEENoAuthRouter(apiNoAuth *gin.RouterGroup, r *Router) {
// For EE
apiNoAuth.GET("/auth/login/channels", r.userHandler.GetLoginChannels)
apiNoAuth.GET("/auth/login/:channel", r.userHandler.OAuthLogin)
apiNoAuth.GET("/auth/oauth/:channel/callback", r.userHandler.OAuthChannelCallback)
apiNoAuth.GET("/auth/oauth/callback", r.userHandler.OAuthCallback)
apiNoAuth.GET("/auth/oauth/github/callback", r.userHandler.GitHubAuthCallback)
apiNoAuth.GET("/auth/oauth/lark/callback", r.userHandler.LarkAuthCallback)