diff options
Diffstat (limited to 'shared/server-commands/videos')
-rw-r--r-- | shared/server-commands/videos/videos-command.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index 2ac426f76..1cceb58db 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts | |||
@@ -482,8 +482,17 @@ export class VideosCommand extends AbstractCommand { | |||
482 | size: number | 482 | size: number |
483 | contentLength?: number | 483 | contentLength?: number |
484 | contentRangeBuilder?: (start: number, chunk: any) => string | 484 | contentRangeBuilder?: (start: number, chunk: any) => string |
485 | digestBuilder?: (chunk: any) => string | ||
485 | }) { | 486 | }) { |
486 | const { pathUploadId, videoFilePath, size, contentLength, contentRangeBuilder, expectedStatus = HttpStatusCode.OK_200 } = options | 487 | const { |
488 | pathUploadId, | ||
489 | videoFilePath, | ||
490 | size, | ||
491 | contentLength, | ||
492 | contentRangeBuilder, | ||
493 | digestBuilder, | ||
494 | expectedStatus = HttpStatusCode.OK_200 | ||
495 | } = options | ||
487 | 496 | ||
488 | const path = '/api/v1/videos/upload-resumable' | 497 | const path = '/api/v1/videos/upload-resumable' |
489 | let start = 0 | 498 | let start = 0 |
@@ -505,6 +514,10 @@ export class VideosCommand extends AbstractCommand { | |||
505 | 'Content-Length': contentLength ? contentLength + '' : chunk.length + '' | 514 | 'Content-Length': contentLength ? contentLength + '' : chunk.length + '' |
506 | } | 515 | } |
507 | 516 | ||
517 | if (digestBuilder) { | ||
518 | Object.assign(headers, { digest: digestBuilder(chunk) }) | ||
519 | } | ||
520 | |||
508 | const res = await got<{ video: VideoCreateResult }>({ | 521 | const res = await got<{ video: VideoCreateResult }>({ |
509 | url, | 522 | url, |
510 | method: 'put', | 523 | method: 'put', |