]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/server-commands/videos/videos-command.ts
Translated using Weblate (French (France) (fr_FR))
[github/Chocobozzz/PeerTube.git] / shared / server-commands / videos / videos-command.ts
index 21753ddc46a71beedf36856a32ab96f9aa0e4371..1cceb58dbd3b259d6ceb264ccbbbc14afb4b5186 100644 (file)
@@ -107,23 +107,6 @@ export class VideosCommand extends AbstractCommand {
 
   // ---------------------------------------------------------------------------
 
-  view (options: OverrideCommandOptions & {
-    id: number | string
-    xForwardedFor?: string
-  }) {
-    const { id, xForwardedFor } = options
-    const path = '/api/v1/videos/' + id + '/views'
-
-    return this.postBodyRequest({
-      ...options,
-
-      path,
-      xForwardedFor,
-      implicitToken: false,
-      defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204
-    })
-  }
-
   rate (options: OverrideCommandOptions & {
     id: number | string
     rating: UserVideoRateType
@@ -499,8 +482,17 @@ export class VideosCommand extends AbstractCommand {
     size: number
     contentLength?: number
     contentRangeBuilder?: (start: number, chunk: any) => string
+    digestBuilder?: (chunk: any) => string
   }) {
-    const { pathUploadId, videoFilePath, size, contentLength, contentRangeBuilder, expectedStatus = HttpStatusCode.OK_200 } = options
+    const {
+      pathUploadId,
+      videoFilePath,
+      size,
+      contentLength,
+      contentRangeBuilder,
+      digestBuilder,
+      expectedStatus = HttpStatusCode.OK_200
+    } = options
 
     const path = '/api/v1/videos/upload-resumable'
     let start = 0
@@ -522,6 +514,10 @@ export class VideosCommand extends AbstractCommand {
           'Content-Length': contentLength ? contentLength + '' : chunk.length + ''
         }
 
+        if (digestBuilder) {
+          Object.assign(headers, { digest: digestBuilder(chunk) })
+        }
+
         const res = await got<{ video: VideoCreateResult }>({
           url,
           method: 'put',