2026-04-27 17:49:19 +03:00
|
|
|
package routing
|
|
|
|
|
|
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
|
|
|
|
|
|
type Handlers struct {
|
|
|
|
|
Index gin.HandlerFunc
|
|
|
|
|
ShowBox gin.HandlerFunc
|
2026-04-27 18:18:53 +03:00
|
|
|
BoxLogin gin.HandlerFunc
|
|
|
|
|
BoxLoginPost gin.HandlerFunc
|
2026-04-27 17:49:19 +03:00
|
|
|
BoxStatus gin.HandlerFunc
|
|
|
|
|
DownloadBox gin.HandlerFunc
|
|
|
|
|
DownloadFile gin.HandlerFunc
|
2026-04-28 18:44:16 +03:00
|
|
|
DownloadThumbnail gin.HandlerFunc
|
2026-04-27 17:49:19 +03:00
|
|
|
CreateBox gin.HandlerFunc
|
|
|
|
|
ManifestFileUpload gin.HandlerFunc
|
|
|
|
|
FileStatusUpdate gin.HandlerFunc
|
|
|
|
|
DirectBoxUpload gin.HandlerFunc
|
|
|
|
|
LegacyUpload gin.HandlerFunc
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Register(router *gin.Engine, handlers Handlers) {
|
|
|
|
|
router.GET("/", handlers.Index)
|
|
|
|
|
|
|
|
|
|
router.GET("/box/:id", handlers.ShowBox)
|
2026-04-27 18:18:53 +03:00
|
|
|
router.GET("/box/:id/login", handlers.BoxLogin)
|
2026-04-27 17:49:19 +03:00
|
|
|
router.GET("/box/:id/status", handlers.BoxStatus)
|
|
|
|
|
router.GET("/box/:id/download", handlers.DownloadBox)
|
|
|
|
|
router.GET("/box/:id/files/:filename", handlers.DownloadFile)
|
2026-04-28 18:44:16 +03:00
|
|
|
router.GET("/box/:id/thumbnails/:file_id", handlers.DownloadThumbnail)
|
2026-04-27 17:49:19 +03:00
|
|
|
|
|
|
|
|
router.POST("/box", handlers.CreateBox)
|
2026-04-27 18:18:53 +03:00
|
|
|
router.POST("/box/:id/login", handlers.BoxLoginPost)
|
2026-04-27 17:49:19 +03:00
|
|
|
router.POST("/box/:id/files/:file_id/upload", handlers.ManifestFileUpload)
|
|
|
|
|
router.POST("/box/:id/files/:file_id/status", handlers.FileStatusUpdate)
|
|
|
|
|
|
|
|
|
|
// Legacy upload routes are kept for compatibility with older clients.
|
|
|
|
|
router.POST("/box/:id/upload", handlers.DirectBoxUpload)
|
|
|
|
|
router.POST("/upload", handlers.LegacyUpload)
|
|
|
|
|
}
|