]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
add client.videos.upload.maxChunkSize config (#4857)
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>
Wed, 16 Mar 2022 09:57:36 +0000 (10:57 +0100)
committerGitHub <noreply@github.com>
Wed, 16 Mar 2022 09:57:36 +0000 (10:57 +0100)
* add client.videos.upload.maxChunkSize config

* updates after review

* remove maxChunkSize from custom-config

client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
config/default.yaml
config/production.yaml.example
server/initializers/config.ts
server/lib/server-config-manager.ts
shared/models/server/server-config.model.ts

index 5655e48da4e4e6cfb772c35ab817fdc51d40e680..c4438d77733fa6ee69840ceb1e957bd72365000c 100644 (file)
@@ -282,7 +282,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
 
     this.resumableUploadService.handleFiles(file, {
       ...this.uploadxOptions,
-      metadata
+      metadata,
+      maxChunkSize: this.serverConfig.client.videos.resumableUpload.maxChunkSize
     })
 
     this.isUploadingVideo = true
index 89839570568b7d5fda8a4977d32fc20841349fc5..42ce12c18809b9c8bc0f91a67124eecd720c18f2 100644 (file)
@@ -631,6 +631,10 @@ client:
       # By default PeerTube client displays author username
       prefer_author_display_name: false
       display_author_avatar: false
+    resumable_upload:
+      # Max size of upload chunks, e.g. '90MB'
+      # If null, it will be calculated based on network speed
+      max_chunk_size: null
 
   menu:
     login:
index 03afe5841b8496e727d80e228daaa4aa2ae957aa..bb1b4615bb412faa45fbdf877fdc4701ec3cf0fb 100644 (file)
@@ -639,6 +639,10 @@ client:
       # By default PeerTube client displays author username
       prefer_author_display_name: false
       display_author_avatar: false
+    resumable_upload:
+      # Max size of upload chunks, e.g. '90MB'
+      # If null, it will be calculated based on network speed
+      max_chunk_size: null
 
   menu:
     login:
index 6dcca9b67cb3fb8ecd3d3ffb66525e25dd370b17..3aadd9cbd6845499a75bda0b75bc4f0237f40666 100644 (file)
@@ -64,6 +64,9 @@ const CONFIG = {
       MINIATURE: {
         get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') },
         get DISPLAY_AUTHOR_AVATAR () { return config.get<boolean>('client.videos.miniature.display_author_avatar') }
+      },
+      RESUMABLE_UPLOAD: {
+        get MAX_CHUNK_SIZE () { return parseBytes(config.get<number>('client.videos.resumable_upload.max_chunk_size') || 0) }
       }
     },
     MENU: {
index 744186cfccc4f0b741c14798a9d2fa457efe1072..b920b73d59889f7d41ec8614324becbac06e07e0 100644 (file)
@@ -48,6 +48,9 @@ class ServerConfigManager {
           miniature: {
             displayAuthorAvatar: CONFIG.CLIENT.VIDEOS.MINIATURE.DISPLAY_AUTHOR_AVATAR,
             preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME
+          },
+          resumableUpload: {
+            maxChunkSize: CONFIG.CLIENT.VIDEOS.RESUMABLE_UPLOAD.MAX_CHUNK_SIZE
           }
         },
         menu: {
index d7fbed13c469b95f744002e1276ff5047fffa567..146bed24bc645ce8bfc12b5451a8be2122b3bf69 100644 (file)
@@ -41,6 +41,9 @@ export interface ServerConfig {
         displayAuthorAvatar: boolean
         preferAuthorDisplayName: boolean
       }
+      resumableUpload: {
+        maxChunkSize: number
+      }
     }
 
     menu: {