diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-03 14:40:52 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-03 14:40:52 +0100 |
commit | 9ea02c48a7a47b5bbed261e847d7d671e266a073 (patch) | |
tree | 9aa64f0f6387a7a3162956ce9730a90c0cb6d3f7 /client/src/app | |
parent | 6d472b4046084e5f477124b11ac62dca9f6a1a63 (diff) | |
parent | 025d858e7997d6b9895fa6b7beaf23bf5ff814af (diff) | |
download | PeerTube-9ea02c48a7a47b5bbed261e847d7d671e266a073.tar.gz PeerTube-9ea02c48a7a47b5bbed261e847d7d671e266a073.tar.zst PeerTube-9ea02c48a7a47b5bbed261e847d7d671e266a073.zip |
Merge branch 'release/4.0.0' into develop
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | 21 |
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 @@ | |||
1 | import { truncate } from 'lodash-es' | ||
1 | import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' | 2 | import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' |
3 | import { isIOS } from 'src/assets/player/utils' | ||
2 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' | 4 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' |
3 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 5 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
4 | import { Router } from '@angular/router' | 6 | import { Router } from '@angular/router' |
@@ -10,7 +12,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core' | |||
10 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' | 12 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' |
11 | import { UploaderXFormData } from './uploaderx-form-data' | 13 | import { UploaderXFormData } from './uploaderx-form-data' |
12 | import { VideoSend } from './video-send' | 14 | import { VideoSend } from './video-send' |
13 | import { 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 | } |