perf: 通用模块分出认证模块

This commit is contained in:
TsMask
2025-03-19 11:32:57 +08:00
parent add8b9d581
commit 5040a5ae40
14 changed files with 120 additions and 113 deletions

View File

@@ -22,63 +22,6 @@ func Setup(router *gin.Engine) {
controller.NewIndex.Handler,
)
// 系统可暴露的配置信息
router.GET("/sys-conf", controller.NewCommon.SysConfig)
// 系统引导初始化
guideGroup := router.Group("/bootloader")
{
guideGroup.POST("", controller.NewBootloader.Start)
guideGroup.PUT("", middleware.PreAuthorize(nil), controller.NewBootloader.Done)
guideGroup.DELETE("", middleware.PreAuthorize(nil), controller.NewBootloader.Reset)
guideGroup.PUT("/account", middleware.PreAuthorize(nil), controller.NewBootloader.Account)
}
// 验证码操作
router.GET("/captcha-image",
middleware.RateLimit(middleware.LimitOption{
Time: 300,
Count: 60,
Type: middleware.LIMIT_IP,
}),
controller.NewCaptcha.Image,
)
// 账号身份操作处理
{
router.POST("/login",
middleware.RateLimit(middleware.LimitOption{
Time: 180,
Count: 15,
Type: middleware.LIMIT_IP,
}),
middleware.CryptoApi(true, true),
controller.NewAccount.Login,
)
router.GET("/me", middleware.PreAuthorize(nil), controller.NewAccount.Me)
router.GET("/router", middleware.PreAuthorize(nil), controller.NewAccount.Router)
router.POST("/logout",
middleware.RateLimit(middleware.LimitOption{
Time: 120,
Count: 15,
Type: middleware.LIMIT_IP,
}),
controller.NewAccount.Logout,
)
}
// 账号注册操作
{
router.POST("/register",
middleware.RateLimit(middleware.LimitOption{
Time: 300,
Count: 10,
Type: middleware.LIMIT_IP,
}),
middleware.CryptoApi(true, true),
controller.NewRegister.Register,
)
}
// 通用请求
commonGroup := router.Group("/common")
{