Files
Hightube/backend/internal/api/router.go
CGH0S7 a0c5e7590d feat: implement chat history, theme customization, and password management
- Added chat history persistence for active rooms with auto-cleanup on stream end.
- Overhauled Settings page with user profile, theme color picker, and password change.
- Added backend API for user password updates.
- Integrated flutter_launcher_icons and updated app icon to 'H' logo.
- Fixed 'Duplicate keys' bug in danmaku by using UniqueKey and filtering historical messages.
- Updated version to 1.0.0-beta3.5 and author info.
2026-03-25 11:48:39 +08:00

35 lines
796 B
Go

package api
import (
"github.com/gin-gonic/gin"
)
// SetupRouter configures the Gin router and defines API endpoints
func SetupRouter() *gin.Engine {
// 设置为发布模式,消除 "[WARNING] Running in debug mode" 警告
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
// 清除代理信任警告 "[WARNING] You trusted all proxies"
r.SetTrustedProxies(nil)
// Public routes
r.POST("/api/register", Register)
r.POST("/api/login", Login)
r.GET("/api/rooms/active", GetActiveRooms)
// WebSocket endpoint for live chat
r.GET("/api/ws/room/:room_id", WSHandler)
// Protected routes (require JWT)
authGroup := r.Group("/api")
authGroup.Use(AuthMiddleware())
{
authGroup.GET("/room/my", GetMyRoom)
authGroup.POST("/user/change-password", ChangePassword)
}
return r
}