refactor: split backend into standalone server project
Remove embedded frontend and workflow editor assets, add standalone API deployment configuration, and retain the current backend service updates.
This commit is contained in:
@@ -42,7 +42,7 @@ func PublicConfig(ctx *gin.Context) {
|
||||
func WxWorkLogin(ctx *gin.Context) {
|
||||
loginURL, err := services.WxWorkLoginService.BuildWxWorkLoginURL(ctx.Query("next"))
|
||||
if err != nil {
|
||||
ctx.Redirect(http.StatusFound, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
redirectToFrontend(ctx, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusFound, loginURL)
|
||||
@@ -51,7 +51,7 @@ func WxWorkLogin(ctx *gin.Context) {
|
||||
func WxWorkQRLogin(ctx *gin.Context) {
|
||||
loginURL, err := services.WxWorkLoginService.BuildWxWorkQRCodeLoginURL(ctx.Query("next"))
|
||||
if err != nil {
|
||||
ctx.Redirect(http.StatusFound, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
redirectToFrontend(ctx, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusFound, loginURL)
|
||||
@@ -67,10 +67,10 @@ func WxWorkCallback(ctx *gin.Context) {
|
||||
ctx.GetHeader("User-Agent"),
|
||||
)
|
||||
if err != nil {
|
||||
ctx.Redirect(http.StatusFound, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
redirectToFrontend(ctx, "/login?wxworkError="+url.QueryEscape(wxWorkErrorMessage(err.Error())))
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusFound, "/dashboard/login/wxwork/callback?ticket="+url.QueryEscape(ticket)+"&next="+url.QueryEscape(next))
|
||||
redirectToFrontend(ctx, "/dashboard/login/wxwork/callback?ticket="+url.QueryEscape(ticket)+"&next="+url.QueryEscape(next))
|
||||
}
|
||||
|
||||
func WxWorkExchange(ctx *gin.Context) {
|
||||
@@ -90,7 +90,7 @@ func WxWorkExchange(ctx *gin.Context) {
|
||||
func OIDCLogin(ctx *gin.Context) {
|
||||
loginURL, err := services.OIDCLoginService.BuildOIDCLoginURL(ctx.Query("next"))
|
||||
if err != nil {
|
||||
ctx.Redirect(http.StatusFound, "/dashboard/login?oidcError="+url.QueryEscape(loginErrorMessage(err.Error())))
|
||||
redirectToFrontend(ctx, "/dashboard/login?oidcError="+url.QueryEscape(loginErrorMessage(err.Error())))
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusFound, loginURL)
|
||||
@@ -107,10 +107,10 @@ func OIDCCallback(ctx *gin.Context) {
|
||||
ctx.GetHeader("User-Agent"),
|
||||
)
|
||||
if err != nil {
|
||||
ctx.Redirect(http.StatusFound, "/dashboard/login?oidcError="+url.QueryEscape(loginErrorMessage(err.Error())))
|
||||
redirectToFrontend(ctx, "/dashboard/login?oidcError="+url.QueryEscape(loginErrorMessage(err.Error())))
|
||||
return
|
||||
}
|
||||
ctx.Redirect(http.StatusFound, "/dashboard/login/oidc/callback?ticket="+url.QueryEscape(ticket)+"&next="+url.QueryEscape(next))
|
||||
redirectToFrontend(ctx, "/dashboard/login/oidc/callback?ticket="+url.QueryEscape(ticket)+"&next="+url.QueryEscape(next))
|
||||
}
|
||||
|
||||
func OIDCExchange(ctx *gin.Context) {
|
||||
@@ -154,3 +154,7 @@ func loginErrorMessage(message string) string {
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
func redirectToFrontend(ctx *gin.Context, path string) {
|
||||
ctx.Redirect(http.StatusFound, config.Current().Server.FrontendBaseURL()+path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user