From 60233e90d280eb865d396b30b63c0e88d13ca7db Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Wed, 16 Mar 2022 10:57:36 +0100 Subject: [PATCH] add client.videos.upload.maxChunkSize config (#4857) * add client.videos.upload.maxChunkSize config * updates after review * remove maxChunkSize from custom-config --- .../video-add-components/video-upload.component.ts | 3 ++- config/default.yaml | 4 ++++ config/production.yaml.example | 4 ++++ server/initializers/config.ts | 3 +++ server/lib/server-config-manager.ts | 3 +++ shared/models/server/server-config.model.ts | 3 +++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index 5655e48da..c4438d777 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts @@ -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 diff --git a/config/default.yaml b/config/default.yaml index 898395705..42ce12c18 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -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: diff --git a/config/production.yaml.example b/config/production.yaml.example index 03afe5841..bb1b4615b 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -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: diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 6dcca9b67..3aadd9cbd 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -64,6 +64,9 @@ const CONFIG = { MINIATURE: { get PREFER_AUTHOR_DISPLAY_NAME () { return config.get('client.videos.miniature.prefer_author_display_name') }, get DISPLAY_AUTHOR_AVATAR () { return config.get('client.videos.miniature.display_author_avatar') } + }, + RESUMABLE_UPLOAD: { + get MAX_CHUNK_SIZE () { return parseBytes(config.get('client.videos.resumable_upload.max_chunk_size') || 0) } } }, MENU: { diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index 744186cfc..b920b73d5 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts @@ -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: { diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index d7fbed13c..146bed24b 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -41,6 +41,9 @@ export interface ServerConfig { displayAuthorAvatar: boolean preferAuthorDisplayName: boolean } + resumableUpload: { + maxChunkSize: number + } } menu: { -- 2.41.0