feat: 更新多个模块以支持新的数据结构和日志格式

This commit is contained in:
TsMask
2025-02-20 10:08:27 +08:00
parent 045a2b6b01
commit f3c33b31ac
272 changed files with 13246 additions and 15885 deletions

View File

@@ -13,18 +13,17 @@ func Setup(router *gin.Engine) {
logger.Infof("开始加载 ====> common 模块路由")
// 路由主页
indexGroup := router.Group("/")
indexGroup.GET("",
// middleware.RateLimit(middleware.LimitOption{
// Time: 300,
// Count: 10,
// Type: middleware.LIMIT_IP,
// }),
router.GET("/",
middleware.RateLimit(middleware.LimitOption{
Time: 300,
Count: 10,
Type: middleware.LIMIT_IP,
}),
controller.NewIndex.Handler,
)
// 系统可暴露的配置信息
indexGroup.GET("/sys-conf", controller.NewCommont.SysConfig)
router.GET("/sys-conf", controller.NewCommon.SysConfig)
// 系统引导初始化
guideGroup := router.Group("/bootloader")
{
@@ -34,47 +33,47 @@ func Setup(router *gin.Engine) {
guideGroup.PUT("/account", middleware.PreAuthorize(nil), controller.NewBootloader.Account)
}
// 验证码操作处理
indexGroup.GET("/captchaImage",
// middleware.RateLimit(middleware.LimitOption{
// Time: 300,
// Count: 60,
// Type: middleware.LIMIT_IP,
// }),
// 验证码操作
router.GET("/captcha-image",
middleware.RateLimit(middleware.LimitOption{
Time: 300,
Count: 60,
Type: middleware.LIMIT_IP,
}),
controller.NewCaptcha.Image,
)
// 账号身份操作处理
{
indexGroup.POST("/login",
// middleware.RateLimit(middleware.LimitOption{
// Time: 300,
// Count: 10,
// Type: middleware.LIMIT_IP,
// }),
router.POST("/login",
middleware.RateLimit(middleware.LimitOption{
Time: 180,
Count: 15,
Type: middleware.LIMIT_IP,
}),
middleware.CryptoApi(true, true),
controller.NewAccount.Login,
)
indexGroup.GET("/getInfo", middleware.PreAuthorize(nil), controller.NewAccount.Info)
indexGroup.GET("/getRouters", middleware.PreAuthorize(nil), controller.NewAccount.Router)
indexGroup.POST("/logout",
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: 300,
Count: 5,
Time: 120,
Count: 15,
Type: middleware.LIMIT_IP,
}),
controller.NewAccount.Logout,
)
}
// 账号注册操作处理
// 账号注册操作
{
indexGroup.POST("/register",
// middleware.RateLimit(middleware.LimitOption{
// Time: 300,
// Count: 10,
// Type: middleware.LIMIT_IP,
// }),
router.POST("/register",
middleware.RateLimit(middleware.LimitOption{
Time: 300,
Count: 10,
Type: middleware.LIMIT_IP,
}),
middleware.CryptoApi(true, true),
controller.NewRegister.Register,
)
@@ -83,8 +82,8 @@ func Setup(router *gin.Engine) {
// 通用请求
commonGroup := router.Group("/common")
{
commonGroup.POST("/hash", middleware.PreAuthorize(nil), controller.NewCommont.Hash)
commonGroup.GET("/i18n", controller.NewCommont.I18n)
commonGroup.POST("/hash", middleware.PreAuthorize(nil), controller.NewCommon.Hash)
commonGroup.GET("/i18n", controller.NewCommon.I18n)
}
// 文件操作处理
@@ -95,6 +94,6 @@ func Setup(router *gin.Engine) {
fileGroup.POST("/chunkCheck", middleware.PreAuthorize(nil), controller.NewFile.ChunkCheck)
fileGroup.POST("/chunkUpload", middleware.PreAuthorize(nil), controller.NewFile.ChunkUpload)
fileGroup.POST("/chunkMerge", middleware.PreAuthorize(nil), controller.NewFile.ChunkMerge)
fileGroup.POST("/transferStaticFile", middleware.PreAuthorize(nil), controller.NewCommont.TransferStaticFile)
fileGroup.POST("/transferStaticFile", middleware.PreAuthorize(nil), controller.NewFile.TransferStaticFile)
}
}