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
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"warpbox/lib/boxstore"
|
||||
"warpbox/lib/helpers"
|
||||
"warpbox/lib/routing"
|
||||
)
|
||||
|
||||
@@ -19,6 +23,7 @@ func Run(addr string) error {
|
||||
BoxStatus: handleBoxStatus,
|
||||
DownloadBox: handleDownloadBox,
|
||||
DownloadFile: handleDownloadFile,
|
||||
DownloadThumbnail: handleDownloadThumbnail,
|
||||
CreateBox: handleCreateBox,
|
||||
ManifestFileUpload: handleManifestFileUpload,
|
||||
FileStatusUpdate: handleFileStatusUpdate,
|
||||
@@ -29,5 +34,9 @@ func Run(addr string) error {
|
||||
compressed := router.Group("/", gzip.Gzip(gzip.DefaultCompression))
|
||||
compressed.Static("/static", "./static")
|
||||
|
||||
batchSize := helpers.EnvInt("WARPBOX_THUMBNAIL_BATCH_SIZE", 10, 1)
|
||||
intervalSeconds := helpers.EnvInt("WARPBOX_THUMBNAIL_INTERVAL_SECONDS", 30, 1)
|
||||
boxstore.StartThumbnailWorker(batchSize, time.Duration(intervalSeconds)*time.Second)
|
||||
|
||||
return router.Run(addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user