Some checks failed
CI / Lint + Build (push) Has been cancelled
审计修复: - CSP: unsafe-inline移除, nonce替代; unsafe-eval保留供Vditor使用 - HSTS: 始终启用(不再依赖release模式) - Controller Exp: common.GetGinExp包装, 不再直接读context - UID解析: common.ParseUIDParam统一, follow/admin controller改用 重构: - router/api.go(198行)拆为7个域文件: auth/settings/posts/comments/reactions/social/studio - 管理后台站点设置: 单页拆为4个子页(brand/security/registration/content)+子菜单 - 前台用户设置页: 1201行拆为6个独立模板+6个独立JS文件 新增: - DB健康检测中间件(middleware/db_health.go): 5s ping+降级页面 - 时区配置: config.yaml server.timezone→time.Local初始化 - .gitea/workflows/ci.yml: strict模式CI流水线
28 lines
772 B
Go
28 lines
772 B
Go
package router
|
||
|
||
import (
|
||
"metazone.cc/mce/internal/config"
|
||
"metazone.cc/mce/internal/middleware"
|
||
|
||
"github.com/gin-gonic/gin"
|
||
)
|
||
|
||
// setupAuthAPIRoutes 注册认证相关 API 路由
|
||
func setupAuthAPIRoutes(r *gin.Engine, cfg *config.Config, d *dependencies) {
|
||
api := r.Group("/api")
|
||
api.Use(middleware.CSRF(cfg))
|
||
{
|
||
// 认证
|
||
api.POST("/auth/check-email", d.authCtrl.CheckEmail)
|
||
api.POST("/auth/register", d.authCtrl.Register)
|
||
api.POST("/auth/login", d.authCtrl.Login)
|
||
api.POST("/auth/confirm-restore", d.authCtrl.ConfirmRestore)
|
||
api.POST("/auth/logout", d.authCtrl.Logout)
|
||
api.POST("/auth/refresh", d.authCtrl.RefreshToken)
|
||
|
||
// 帖子公开 API(无需登录)
|
||
api.GET("/posts", d.postCtrl.ListAPI)
|
||
api.GET("/posts/:id", d.postCtrl.ShowAPI)
|
||
}
|
||
}
|