Files
WarpBox/lib/routing/routes.go
Daniel Legt f1600faa8d feat: add thumbnail metadata and download endpoint
- Extend `BoxFile` with thumbnail path/status fields and internal URL
- Populate `ThumbnailURL` when a thumbnail path is present during decoration
- Add `/box/:id/thumbnails/:file_id` route and handler to serve JPEG thumbnails
- Introduce thumbnail status constants to standardize processing state reportingfeat: add thumbnail metadata and download endpoint

- Extend `BoxFile` with thumbnail path/status fields and internal URL
- Populate `ThumbnailURL` when a thumbnail path is present during decoration
- Add `/box/:id/thumbnails/:file_id` route and handler to serve JPEG thumbnails
- Introduce thumbnail status constants to standardize processing state reporting
2026-04-28 18:44:16 +03:00

40 lines
1.4 KiB
Go

package routing
import "github.com/gin-gonic/gin"
type Handlers struct {
Index gin.HandlerFunc
ShowBox gin.HandlerFunc
BoxLogin gin.HandlerFunc
BoxLoginPost gin.HandlerFunc
BoxStatus gin.HandlerFunc
DownloadBox gin.HandlerFunc
DownloadFile gin.HandlerFunc
DownloadThumbnail gin.HandlerFunc
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)
router.GET("/box/:id/login", handlers.BoxLogin)
router.GET("/box/:id/status", handlers.BoxStatus)
router.GET("/box/:id/download", handlers.DownloadBox)
router.GET("/box/:id/files/:filename", handlers.DownloadFile)
router.GET("/box/:id/thumbnails/:file_id", handlers.DownloadThumbnail)
router.POST("/box", handlers.CreateBox)
router.POST("/box/:id/login", handlers.BoxLoginPost)
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)
}