aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts21
2 files changed, 19 insertions, 4 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
index 048f7908d..1158f027b 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html
@@ -51,7 +51,7 @@
51 i18n-labelText labelText="Allow additional extensions" 51 i18n-labelText labelText="Allow additional extensions"
52 > 52 >
53 <ng-container ngProjectAs="description"> 53 <ng-container ngProjectAs="description">
54 <span i18n>Allows users to upload {{ additionalVideoExtensions }} videos.</span> 54 <span i18n>Allows users to upload videos with additional extensions than .mp4, .ogv and .webm (for example: .avi, .mov, .mkv etc).</span>
55 </ng-container> 55 </ng-container>
56 </my-peertube-checkbox> 56 </my-peertube-checkbox>
57 </div> 57 </div>
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 76205db44..28d7ec458 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
@@ -1,4 +1,6 @@
1import { truncate } from 'lodash-es'
1import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' 2import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx'
3import { isIOS } from 'src/assets/player/utils'
2import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' 4import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http'
3import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' 5import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
4import { Router } from '@angular/router' 6import { Router } from '@angular/router'
@@ -10,7 +12,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core'
10import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' 12import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
11import { UploaderXFormData } from './uploaderx-form-data' 13import { UploaderXFormData } from './uploaderx-form-data'
12import { VideoSend } from './video-send' 14import { VideoSend } from './video-send'
13import { isIOS } from 'src/assets/player/utils'
14 15
15@Component({ 16@Component({
16 selector: 'my-video-upload', 17 selector: 'my-video-upload',
@@ -281,6 +282,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
281 channelId: this.firstStepChannelId, 282 channelId: this.firstStepChannelId,
282 nsfw: this.serverConfig.instance.isNSFW, 283 nsfw: this.serverConfig.instance.isNSFW,
283 privacy: this.highestPrivacy.toString(), 284 privacy: this.highestPrivacy.toString(),
285 name: this.buildVideoFilename(file.name),
284 filename: file.name, 286 filename: file.name,
285 previewfile: previewfile as any 287 previewfile: previewfile as any
286 } 288 }
@@ -311,8 +313,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
311 } 313 }
312 314
313 private closeFirstStep (filename: string) { 315 private closeFirstStep (filename: string) {
314 const nameWithoutExtension = filename.replace(/\.[^/.]+$/, '') 316 const name = this.buildVideoFilename(filename)
315 const name = nameWithoutExtension.length < 3 ? filename : nameWithoutExtension
316 317
317 this.form.patchValue({ 318 this.form.patchValue({
318 name, 319 name,
@@ -369,4 +370,18 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
369 370
370 return extensions.some(e => filename.endsWith(e)) 371 return extensions.some(e => filename.endsWith(e))
371 } 372 }
373
374 private buildVideoFilename (filename: string) {
375 const nameWithoutExtension = filename.replace(/\.[^/.]+$/, '')
376 let name = nameWithoutExtension.length < 3
377 ? filename
378 : nameWithoutExtension
379
380 const videoNameMaxSize = 110
381 if (name.length > videoNameMaxSize) {
382 name = truncate(name, { length: videoNameMaxSize, omission: '' })
383 }
384
385 return name
386 }
372} 387}