feat: direct download files through backrest webui

This commit is contained in:
Gareth
2025-09-28 00:35:15 -07:00
parent 6cf7df23b8
commit 200e160b0f
9 changed files with 254 additions and 73 deletions

View File

@@ -743,10 +743,14 @@ func (s *BackrestHandler) GetDownloadURL(ctx context.Context, req *connect.Reque
if err != nil {
return nil, fmt.Errorf("failed to get operation %v: %w", req.Msg.Value, err)
}
_, ok := op.Op.(*v1.Operation_OperationRestore)
if !ok {
return nil, fmt.Errorf("operation %v is not a restore operation", req.Msg.Value)
switch op.Op.(type) {
case *v1.Operation_OperationIndexSnapshot:
case *v1.Operation_OperationRestore:
default:
return nil, fmt.Errorf("operation %v is not a restore or snapshot operation", req.Msg.Value)
}
signature, err := signInt64(op.Id) // the signature authenticates the download URL. Note that the shared URL will be valid for any downloader.
if err != nil {
return nil, fmt.Errorf("failed to generate signature: %w", err)