新增配置管理功能及多存储支持

- 添加管理员端 API,用于获取和更新完整配置。
- 添加公共端 API,用于获取非敏感配置信息。
- 增加本地存储(LocalStorage)、S3(S3Storage)、和 WebDAV(WebDAVStorage)存储类型的实现。
- 支持热更新存储配置和保存配置文件至磁盘。
- 更新 Swagger 文档以包含新接口定义。
This commit is contained in:
2026-01-14 14:15:20 +08:00
parent 1ffa16cf48
commit fe656fb298
13 changed files with 1043 additions and 6 deletions

View File

@@ -66,9 +66,11 @@ func main() {
// 公共接口
uploadHandler := public.NewUploadHandler()
pickupHandler := public.NewPickupHandler()
publicConfigHandler := public.NewConfigHandler()
api := r.Group("/api")
{
api.GET("/config", publicConfigHandler.GetPublicConfig)
// 统一使用 /batches 作为资源路径
api.POST("/batches", uploadHandler.Upload)
api.POST("/batches/text", uploadHandler.UploadText)
@@ -85,12 +87,16 @@ func main() {
authHandler := admin.NewAuthHandler()
batchHandler := admin.NewBatchHandler()
tokenHandler := admin.NewTokenHandler()
configHandler := admin.NewConfigHandler()
r.POST("/admin/login", authHandler.Login)
adm := r.Group("/admin")
adm.Use(middleware.AdminAuth())
{
adm.GET("/config", configHandler.GetConfig)
adm.PUT("/config", configHandler.UpdateConfig)
adm.GET("/batches", batchHandler.ListBatches)
adm.GET("/batches/:batch_id", batchHandler.GetBatch)
adm.PUT("/batches/:batch_id", batchHandler.UpdateBatch)