feat(upload): add resumable chunk configuration and file validation
Some checks failed
Build and Publish Docker Image / deploy (push) Failing after 56s

- Add `WARPBOX_RESUMABLE_CHUNK_MODE` and `WARPBOX_RESUMABLE_CHUNK_PATH` environment variables to configure temporary chunk storage.
- Implement strict file validation for resuming uploads to ensure selected files match the pending session's metadata.
- Add `PLANS.md` to document development stages, roadmap, and API specifications (including batching and resumable flows).
This commit is contained in:
2026-06-02 22:13:54 +03:00
parent 5cd476e7f3
commit 313c89483c
22 changed files with 1809 additions and 324 deletions

View File

@@ -55,6 +55,11 @@ type SettingsDefaults struct {
ShortWindowSeconds int
AnonymousStorageBackend string
UserStorageBackend string
ResumableUploadsEnabled bool
ResumableChunkSizeMB float64
ResumableRetentionHours int
ResumableChunkMode string
ResumableChunkPath string
}
func Load() (Config, error) {
@@ -100,8 +105,13 @@ func Load() (Config, error) {
ShortWindowSeconds: envInt("WARPBOX_SHORT_WINDOW_SECONDS", 60),
AnonymousStorageBackend: envString("WARPBOX_ANONYMOUS_STORAGE_BACKEND", "local"),
UserStorageBackend: envString("WARPBOX_USER_STORAGE_BACKEND", "local"),
ResumableChunkMode: envString("WARPBOX_RESUMABLE_CHUNK_MODE", "same"),
ResumableChunkPath: envString("WARPBOX_RESUMABLE_CHUNK_PATH", ""),
},
}
cfg.DefaultSettings.ResumableUploadsEnabled = cfg.ResumableUploadsEnabled
cfg.DefaultSettings.ResumableChunkSizeMB = float64(cfg.ResumableChunkSize) / 1024 / 1024
cfg.DefaultSettings.ResumableRetentionHours = int(cfg.ResumableRetention / time.Hour)
if cfg.BaseURL == "" {
return Config{}, fmt.Errorf("WARPBOX_BASE_URL cannot be empty")