- Go 后端 handler 错误消息统一中文化(middleware/repos/generate/review/settings) - 前端 JS 加载和错误消息中文化(diff-viewer.js, graph.js) - 模板页面错误 fallback 和静态文本中文化(index/generate/review/base) - 消除中英文混杂,提升中文用户体验
This commit is contained in:
@@ -19,7 +19,7 @@ func AuthRequired(db *sql.DB) gin.HandlerFunc {
|
||||
if userID == nil {
|
||||
// Check if it's an API request
|
||||
if len(c.Request.URL.Path) > 4 && c.Request.URL.Path[:5] == "/api/" {
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "unauthenticated"})
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "未登录"})
|
||||
} else {
|
||||
c.Redirect(http.StatusFound, "/login")
|
||||
c.Abort()
|
||||
@@ -36,7 +36,7 @@ func AuthRequired(db *sql.DB) gin.HandlerFunc {
|
||||
session.Clear()
|
||||
session.Save()
|
||||
if len(c.Request.URL.Path) > 4 && c.Request.URL.Path[:5] == "/api/" {
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "unauthenticated"})
|
||||
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "未登录"})
|
||||
} else {
|
||||
c.Redirect(http.StatusFound, "/login")
|
||||
c.Abort()
|
||||
|
||||
Reference in New Issue
Block a user