Add upload progress bar with SSE extraction status
ISO uploads now show a progress bar during file transfer (via XHR upload.onprogress) and real-time extraction status (via SSE events through the existing Hub). Falls back to plain form POST if JS is disabled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,10 +18,11 @@ type Service struct {
|
||||
}
|
||||
|
||||
type UploadParams struct {
|
||||
Name string
|
||||
Kind string
|
||||
Version string
|
||||
ISO io.Reader
|
||||
Name string
|
||||
Kind string
|
||||
Version string
|
||||
ISO io.Reader
|
||||
OnProgress ProgressFunc
|
||||
}
|
||||
|
||||
var slugRegex = regexp.MustCompile(`^[a-z0-9][a-z0-9.-]*$`)
|
||||
@@ -46,7 +47,7 @@ func (s *Service) Upload(ctx context.Context, p UploadParams) (*model.Image, err
|
||||
return nil, fmt.Errorf("create image dir: %w", err)
|
||||
}
|
||||
|
||||
result, err := ExtractFromISO(p.ISO, destDir)
|
||||
result, err := ExtractFromISOWithProgress(p.ISO, destDir, p.OnProgress)
|
||||
if err != nil {
|
||||
os.RemoveAll(destDir)
|
||||
return nil, fmt.Errorf("extract ISO: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user