From 244b4ae3973bc1511464a08158a123767f83179c Mon Sep 17 00:00:00 2001 From: BO41 Date: Thu, 18 Oct 2018 09:08:59 +0200 Subject: NoImplicitAny flag true (#1157) this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137 --- .../+video-edit/video-add-components/video-import-torrent.component.ts | 2 +- client/src/app/videos/+video-edit/video-add-components/video-send.ts | 2 +- .../videos/+video-edit/video-add-components/video-upload.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 0f7184ff8..9a50e2ab2 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('torrentfileInput') torrentfileInput + @ViewChild('torrentfileInput') torrentfileInput: any videoFileName: string magnetUri = '' diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 6d1bac3f2..cf9d47cbe 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo protected videoService: VideoService protected videoCaptionService: VideoCaptionService - abstract canDeactivate () + abstract canDeactivate (): any ngOnInit () { this.buildForm({}) 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 941dc5441..fa6ee0c23 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 @@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('videofileInput') videofileInput + @ViewChild('videofileInput') videofileInput: any // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY -- cgit v1.2.3 From c199c427d4ae586339822320f20f512a7a19dc3f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 14:35:31 +0200 Subject: Better typings --- .../video-add-components/video-import-torrent.component.ts | 6 +++--- .../src/app/videos/+video-edit/video-add-components/video-send.ts | 6 +++--- .../+video-edit/video-add-components/video-upload.component.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 9a50e2ab2..e13c06ce9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' +import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { NotificationsService } from 'angular2-notifications' import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' @@ -23,7 +23,7 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('torrentfileInput') torrentfileInput: any + @ViewChild('torrentfileInput') torrentfileInput: ElementRef videoFileName: string magnetUri = '' @@ -64,7 +64,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca } fileChange () { - const torrentfile = this.torrentfileInput.nativeElement.files[0] as File + const torrentfile = this.torrentfileInput.nativeElement.files[0] if (!torrentfile) return this.importVideo(torrentfile) diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index cf9d47cbe..1bf22e1a9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -3,7 +3,6 @@ import { LoadingBarService } from '@ngx-loading-bar/core' import { NotificationsService } from 'angular2-notifications' import { catchError, switchMap, tap } from 'rxjs/operators' import { FormReactive } from '@app/shared' -import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' import { VideoConstant, VideoPrivacy } from '../../../../../../shared' import { AuthService, ServerService } from '@app/core' import { VideoService } from '@app/shared/video/video.service' @@ -11,8 +10,9 @@ import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.m import { VideoCaptionService } from '@app/shared/video-caption' import { VideoEdit } from '@app/shared/video/video-edit.model' import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' +import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service' -export abstract class VideoSend extends FormReactive implements OnInit, CanComponentDeactivate { +export abstract class VideoSend extends FormReactive implements OnInit { userVideoChannels: { id: number, label: string, support: string }[] = [] videoPrivacies: VideoConstant[] = [] videoCaptions: VideoCaptionEdit[] = [] @@ -30,7 +30,7 @@ export abstract class VideoSend extends FormReactive implements OnInit, CanCompo protected videoService: VideoService protected videoCaptionService: VideoCaptionService - abstract canDeactivate (): any + abstract canDeactivate (): CanComponentDeactivateResult ngOnInit () { this.buildForm({}) 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 fa6ee0c23..8e2d0deaf 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,5 +1,5 @@ import { HttpEventType, HttpResponse } from '@angular/common/http' -import { Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' +import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { LoadingBarService } from '@ngx-loading-bar/core' import { NotificationsService } from 'angular2-notifications' @@ -25,7 +25,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() - @ViewChild('videofileInput') videofileInput: any + @ViewChild('videofileInput') videofileInput: ElementRef // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY @@ -110,7 +110,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy } uploadFirstStep () { - const videofile = this.videofileInput.nativeElement.files[0] as File + const videofile = this.videofileInput.nativeElement.files[0] if (!videofile) return // Cannot upload videos > 8GB for now -- cgit v1.2.3 From 7373507fa830b0f18cb4cd95dfd923b1600e501d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Nov 2018 10:05:25 +0100 Subject: Improve video upload error handling --- .../video-add-components/video-import-torrent.component.html | 7 ++++++- .../video-add-components/video-import-torrent.component.scss | 8 ++++++++ .../video-add-components/video-import-torrent.component.ts | 9 ++++++--- .../video-add-components/video-import-url.component.html | 8 +++++++- .../video-add-components/video-import-url.component.scss | 8 ++++++++ .../video-add-components/video-import-url.component.ts | 9 ++++++--- .../app/videos/+video-edit/video-add-components/video-send.ts | 1 + .../video-add-components/video-upload.component.html | 9 +++++++-- .../video-add-components/video-upload.component.scss | 10 +++++++++- .../+video-edit/video-add-components/video-upload.component.ts | 9 +++++++-- 10 files changed, 65 insertions(+), 13 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html index a933a64f0..11a81ad66 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html @@ -45,7 +45,12 @@ -
+
+
Sorry, but something went wrong
+ {{ error }} +
+ +
Congratulations, the video will be imported with BitTorrent! You can already add information about this video.
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss index 262b0b68e..00626cd7b 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss @@ -7,6 +7,14 @@ $width-size: 190px; @include peertube-select-container($width-size); } +.alert.alert-danger { + text-align: center; + + & > div { + font-weight: $font-semibold; + } +} + .import-video-torrent { display: flex; flex-direction: column; diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index e13c06ce9..13776ae36 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -12,6 +12,7 @@ import { VideoEdit } from '@app/shared/video/video-edit.model' import { FormValidatorService } from '@app/shared' import { VideoCaptionService } from '@app/shared/video-caption' import { VideoImportService } from '@app/shared/video-import' +import { scrollToTop } from '@app/shared/misc/utils' @Component({ selector: 'my-video-import-torrent', @@ -23,9 +24,9 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() + @Output() firstStepError = new EventEmitter() @ViewChild('torrentfileInput') torrentfileInput: ElementRef - videoFileName: string magnetUri = '' isImportingVideo = false @@ -33,6 +34,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca isUpdatingVideo = false video: VideoEdit + error: string protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC @@ -104,6 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca err => { this.loadingBar.complete() this.isImportingVideo = false + this.firstStepError.emit() this.notificationsService.error(this.i18n('Error'), err.message) } ) @@ -129,8 +132,8 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca }, err => { - this.isUpdatingVideo = false - this.notificationsService.error(this.i18n('Error'), err.message) + this.error = err.message + scrollToTop() console.error(err) } ) diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html index 9f5fc6d22..533446672 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html @@ -37,7 +37,13 @@
-
+ +
+
Sorry, but something went wrong
+ {{ error }} +
+ +
Congratulations, the video behind {{ targetUrl }} will be imported! You can already add information about this video.
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss index 7c6deda1d..e907edc70 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss @@ -7,6 +7,14 @@ $width-size: 190px; @include peertube-select-container($width-size); } +.alert.alert-danger { + text-align: center; + + & > div { + font-weight: $font-semibold; + } +} + .import-video-url { display: flex; flex-direction: column; diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 031e557ed..9cdface75 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -12,6 +12,7 @@ import { VideoEdit } from '@app/shared/video/video-edit.model' import { FormValidatorService } from '@app/shared' import { VideoCaptionService } from '@app/shared/video-caption' import { VideoImportService } from '@app/shared/video-import' +import { scrollToTop } from '@app/shared/misc/utils' @Component({ selector: 'my-video-import-url', @@ -23,15 +24,16 @@ import { VideoImportService } from '@app/shared/video-import' }) export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() + @Output() firstStepError = new EventEmitter() targetUrl = '' - videoFileName: string isImportingVideo = false hasImportedVideo = false isUpdatingVideo = false video: VideoEdit + error: string protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC @@ -96,6 +98,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom err => { this.loadingBar.complete() this.isImportingVideo = false + this.firstStepError.emit() this.notificationsService.error(this.i18n('Error'), err.message) } ) @@ -121,8 +124,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom }, err => { - this.isUpdatingVideo = false - this.notificationsService.error(this.i18n('Error'), err.message) + this.error = err.message + scrollToTop() console.error(err) } ) diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 1bf22e1a9..71d2544d8 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -21,6 +21,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { firstStepChannelId = 0 abstract firstStepDone: EventEmitter + abstract firstStepError: EventEmitter protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy protected loadingBar: LoadingBarService diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index fa57c8cb5..a09f54dfc 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html @@ -29,7 +29,7 @@
-
+
+
+
Sorry, but something went wrong
+ {{ error }} +
+
- \ No newline at end of file + diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss index dbae5230d..cf1725ef9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss @@ -5,6 +5,14 @@ @include peertube-select-container(190px); } +.alert.alert-danger { + text-align: center; + + & > div { + font-weight: $font-semibold; + } +} + .upload-video { display: flex; flex-direction: column; @@ -82,4 +90,4 @@ margin-left: 10px; } -} \ No newline at end of file +} 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 8e2d0deaf..3fcb71ac3 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 @@ -14,6 +14,7 @@ import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-se import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' import { FormValidatorService, UserService } from '@app/shared' import { VideoCaptionService } from '@app/shared/video-caption' +import { scrollToTop } from '@app/shared/misc/utils' @Component({ selector: 'my-video-upload', @@ -25,6 +26,7 @@ import { VideoCaptionService } from '@app/shared/video-caption' }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { @Output() firstStepDone = new EventEmitter() + @Output() firstStepError = new EventEmitter() @ViewChild('videofileInput') videofileInput: ElementRef // So that it can be accessed in the template @@ -43,6 +45,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy uuid: '' } + error: string + protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC constructor ( @@ -201,6 +205,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy this.isUploadingVideo = false this.videoUploadPercents = 0 this.videoUploadObservable = null + this.firstStepError.emit() this.notificationsService.error(this.i18n('Error'), err.message) } ) @@ -235,8 +240,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy }, err => { - this.isUpdatingVideo = false - this.notificationsService.error(this.i18n('Error'), err.message) + this.error = err.message + scrollToTop() console.error(err) } ) -- cgit v1.2.3 From 4b49385892b25aea5aa9e605fbcb66074bcb49b0 Mon Sep 17 00:00:00 2001 From: Micah Elizabeth Scott Date: Fri, 7 Dec 2018 05:58:17 -0800 Subject: Remove hard-coded 8GB upload limit in client (#1293) * Remove hard-coded 8GB upload limit in client Ideally we'd know what the specific server's configured upload limit is before starting, but this 8GB limit is not useful if an administrator has changed the nginx post limit on the server. * Better docs for admins about client_max_body_size Seems like some admins already tweak this value up or down to allow for different maximum video upload sizes. The current codebase has no other server-side limits that I'm aware of, and I've been routinely uploading quite large videos to my instance. This patch replaces the somewhat incorrect (or outdated?) 'hard limit' comment with some advice about allocating enough space for nginx and communicating the limit with your users. Of course it would be better if this configuration could be unified with PeerTube's config somehow. I'm not sure whether the best option there is to turn off nginx's buffering here and let PeerTube handle the entire upload (can we do this only for the video upload API endpoint?) or whether we want PeerTube to generate nginx configs in a more automated way layer. In any case, this patch is intended as an incremental improvement. --- .../+video-edit/video-add-components/video-upload.component.ts | 6 ------ 1 file changed, 6 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') 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 3fcb71ac3..7ea3691fa 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 @@ -117,12 +117,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy const videofile = this.videofileInput.nativeElement.files[0] if (!videofile) return - // Cannot upload videos > 8GB for now - if (videofile.size > 8 * 1024 * 1024 * 1024) { - this.notificationsService.error(this.i18n('Error'), this.i18n('We are sorry but PeerTube cannot handle videos > 8GB')) - return - } - const bytePipes = new BytesPipe() const videoQuota = this.authService.getUser().videoQuota if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { -- cgit v1.2.3 From 14e2014acc1362cfbb770c051a7254b156cd8efb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Dec 2018 14:52:50 +0100 Subject: Support additional video extensions --- .../+video-edit/video-add-components/video-upload.component.html | 3 ++- .../+video-edit/video-add-components/video-upload.component.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index a09f54dfc..289a28c66 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html @@ -6,7 +6,7 @@ Select the file to upload - (.mp4, .webm, .ogv) + ({{ videoExtensions }})
@@ -47,6 +47,7 @@
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 7ea3691fa..2180e22ab 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 @@ -44,6 +44,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy id: 0, uuid: '' } + waitTranscodingEnabled = true error: string @@ -117,6 +118,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy const videofile = this.videofileInput.nativeElement.files[0] if (!videofile) return + // Check global user quota const bytePipes = new BytesPipe() const videoQuota = this.authService.getUser().videoQuota if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { @@ -132,6 +134,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy return } + // Check daily user quota const videoQuotaDaily = this.authService.getUser().videoQuotaDaily if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { const msg = this.i18n( @@ -146,6 +149,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy return } + // Build name field const nameWithoutExtension = videofile.name.replace(/\.[^/.]+$/, '') let name: string @@ -153,6 +157,11 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy if (nameWithoutExtension.length < 3) name = videofile.name else name = nameWithoutExtension + // Force user to wait transcoding for unsupported video types in web browsers + if (!videofile.name.endsWith('.mp4') && !videofile.name.endsWith('.webm') && !videofile.name.endsWith('.ogv')) { + this.waitTranscodingEnabled = false + } + const privacy = this.firstStepPrivacyId.toString() const nsfw = false const waitTranscoding = true -- cgit v1.2.3 From 276d96529529621d5f70473990095495f2743c29 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Dec 2018 11:32:37 +0100 Subject: Add ability to disable and clear history --- .../+video-edit/video-add-components/video-upload.component.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss index cf1725ef9..4b2c86ae9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss @@ -54,9 +54,7 @@ /deep/ .ui-progressbar { font-size: 15px !important; - color: #fff !important; height: 30px !important; - line-height: 30px !important; border-radius: 3px !important; background-color: rgba(11, 204, 41, 0.16) !important; @@ -68,6 +66,8 @@ text-align: left; padding-left: 18px; margin-top: 0 !important; + color: #fff !important; + line-height: 30px !important; } } -- cgit v1.2.3 From f8b2c1b4f509c037b9650cca2c5befd21f056df3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Dec 2018 16:04:34 +0100 Subject: Refractor notification service Shorter name and use primeng component --- .../video-import-torrent.component.ts | 9 ++++----- .../video-add-components/video-import-url.component.ts | 9 ++++----- .../videos/+video-edit/video-add-components/video-send.ts | 5 ++--- .../video-add-components/video-upload.component.ts | 15 +++++++-------- 4 files changed, 17 insertions(+), 21 deletions(-) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 13776ae36..63db06919 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -1,8 +1,7 @@ import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' -import { NotificationsService } from 'angular2-notifications' import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' -import { AuthService, ServerService } from '../../../core' +import { AuthService, Notifier, ServerService } from '../../../core' import { VideoService } from '../../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { LoadingBarService } from '@ngx-loading-bar/core' @@ -41,7 +40,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca constructor ( protected formValidatorService: FormValidatorService, protected loadingBar: LoadingBarService, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected serverService: ServerService, protected videoService: VideoService, @@ -107,7 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca this.loadingBar.complete() this.isImportingVideo = false this.firstStepError.emit() - this.notificationsService.error(this.i18n('Error'), err.message) + this.notifier.error(err.message) } ) } @@ -126,7 +125,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca .subscribe( () => { this.isUpdatingVideo = false - this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) + this.notifier.success(this.i18n('Video to import updated.')) this.router.navigate([ '/my-account', 'video-imports' ]) }, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 9cdface75..a1810b7a0 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -1,8 +1,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core' import { Router } from '@angular/router' -import { NotificationsService } from 'angular2-notifications' import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' -import { AuthService, ServerService } from '../../../core' +import { AuthService, Notifier, ServerService } from '../../../core' import { VideoService } from '../../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' import { LoadingBarService } from '@ngx-loading-bar/core' @@ -40,7 +39,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom constructor ( protected formValidatorService: FormValidatorService, protected loadingBar: LoadingBarService, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected serverService: ServerService, protected videoService: VideoService, @@ -99,7 +98,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom this.loadingBar.complete() this.isImportingVideo = false this.firstStepError.emit() - this.notificationsService.error(this.i18n('Error'), err.message) + this.notifier.error(err.message) } ) } @@ -118,7 +117,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom .subscribe( () => { this.isUpdatingVideo = false - this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) + this.notifier.success(this.i18n('Video to import updated.')) this.router.navigate([ '/my-account', 'video-imports' ]) }, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 71d2544d8..580c123a0 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts @@ -1,10 +1,9 @@ import { EventEmitter, OnInit } from '@angular/core' import { LoadingBarService } from '@ngx-loading-bar/core' -import { NotificationsService } from 'angular2-notifications' +import { AuthService, Notifier, ServerService } from '@app/core' import { catchError, switchMap, tap } from 'rxjs/operators' import { FormReactive } from '@app/shared' import { VideoConstant, VideoPrivacy } from '../../../../../../shared' -import { AuthService, ServerService } from '@app/core' import { VideoService } from '@app/shared/video/video.service' import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' import { VideoCaptionService } from '@app/shared/video-caption' @@ -25,7 +24,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy protected loadingBar: LoadingBarService - protected notificationsService: NotificationsService + protected notifier: Notifier protected authService: AuthService protected serverService: ServerService protected videoService: VideoService 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 2180e22ab..aa40f8781 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 @@ -2,11 +2,10 @@ import { HttpEventType, HttpResponse } from '@angular/common/http' import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' import { Router } from '@angular/router' import { LoadingBarService } from '@ngx-loading-bar/core' -import { NotificationsService } from 'angular2-notifications' import { BytesPipe } from 'ngx-pipes' import { Subscription } from 'rxjs' import { VideoPrivacy } from '../../../../../../shared/models/videos' -import { AuthService, ServerService } from '../../../core' +import { AuthService, Notifier, ServerService } from '../../../core' import { VideoEdit } from '../../../shared/video/video-edit.model' import { VideoService } from '../../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' @@ -53,7 +52,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy constructor ( protected formValidatorService: FormValidatorService, protected loadingBar: LoadingBarService, - protected notificationsService: NotificationsService, + protected notifier: Notifier, protected authService: AuthService, protected serverService: ServerService, protected videoService: VideoService, @@ -110,7 +109,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy this.isUploadingVideo = false this.videoUploadPercents = 0 this.videoUploadObservable = null - this.notificationsService.info(this.i18n('Info'), this.i18n('Upload cancelled')) + this.notifier.info(this.i18n('Upload cancelled')) } } @@ -130,7 +129,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy videoQuota: bytePipes.transform(videoQuota, 0) } ) - this.notificationsService.error(this.i18n('Error'), msg) + this.notifier.error(msg) return } @@ -145,7 +144,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy quotaDaily: bytePipes.transform(videoQuotaDaily, 0) } ) - this.notificationsService.error(this.i18n('Error'), msg) + this.notifier.error(msg) return } @@ -209,7 +208,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy this.videoUploadPercents = 0 this.videoUploadObservable = null this.firstStepError.emit() - this.notificationsService.error(this.i18n('Error'), err.message) + this.notifier.error(err.message) } ) } @@ -238,7 +237,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy this.isUpdatingVideo = false this.isUploadingVideo = false - this.notificationsService.success(this.i18n('Success'), this.i18n('Video published.')) + this.notifier.success(this.i18n('Video published.')) this.router.navigate([ '/videos/watch', video.uuid ]) }, -- cgit v1.2.3 From 674a66bbda7ceb7aed3c2e6aefddc2793207d94b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Jan 2019 14:55:43 +0100 Subject: Add unload listener on video upload/update --- .../+video-edit/video-add-components/video-upload.component.html | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index 289a28c66..826e54d25 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html @@ -42,6 +42,10 @@ {{ error }}
+
+ Congratulations! Your video is now available in your private library. +
+
Date: Wed, 16 Jan 2019 16:05:40 +0100 Subject: Refactor how we use icons Inject them in an angular component so we can easily change their color --- .../video-import-torrent.component.html | 6 +-- .../video-import-torrent.component.scss | 53 +-------------------- .../video-import-torrent.component.ts | 3 +- .../video-import-url.component.html | 6 +-- .../video-import-url.component.scss | 45 ------------------ .../video-import-url.component.ts | 2 +- .../video-add-components/video-send.scss | 54 ++++++++++++++++++++++ .../video-upload.component.html | 6 +-- .../video-upload.component.scss | 44 ++---------------- .../video-add-components/video-upload.component.ts | 3 +- 10 files changed, 72 insertions(+), 150 deletions(-) delete mode 100644 client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss create mode 100644 client/src/app/videos/+video-edit/video-add-components/video-send.scss (limited to 'client/src/app/videos/+video-edit/video-add-components') diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html index 11a81ad66..28eb143c9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html @@ -1,6 +1,6 @@
-
-
+
+
Select the torrent to import @@ -66,7 +66,7 @@ (click)="updateSecondStep()" [ngClass]="{ disabled: !form.valid || isUpdatingVideo === true }" > - +
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss index 00626cd7b..6d59ed834 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.scss @@ -1,45 +1,7 @@ @import 'variables'; @import 'mixins'; -$width-size: 190px; - -.peertube-select-container { - @include peertube-select-container($width-size); -} - -.alert.alert-danger { - text-align: center; - - & > div { - font-weight: $font-semibold; - } -} - -.import-video-torrent { - display: flex; - flex-direction: column; - align-items: center; - - .icon.icon-upload { - @include icon(90px); - margin-bottom: 25px; - cursor: default; - - background-image: url('../../../../assets/images/video/upload.svg'); - } - - .button-file { - @include peertube-button-file(auto); - - min-width: 190px; - } - - .button-file-extension { - display: block; - font-size: 12px; - margin-top: 5px; - } - +.first-step-block { .torrent-or-magnet { margin: 10px 0; } @@ -47,19 +9,6 @@ $width-size: 190px; .form-group-magnet-uri { margin-bottom: 40px; } - - input[type=text] { - @include peertube-input-text($width-size); - display: block; - } - - input[type=button] { - @include peertube-button; - @include orange-button; - - width: $width-size; - margin-top: 30px; - } } diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 63db06919..307806bb9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -18,7 +18,8 @@ import { scrollToTop } from '@app/shared/misc/utils' templateUrl: './video-import-torrent.component.html', styleUrls: [ '../shared/video-edit.component.scss', - './video-import-torrent.component.scss' + './video-import-torrent.component.scss', + './video-send.scss' ] }) export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html index 533446672..3550c3585 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html @@ -1,6 +1,6 @@
-
-
+
+
@@ -59,7 +59,7 @@ (click)="updateSecondStep()" [ngClass]="{ disabled: !form.valid || isUpdatingVideo === true }" > - +
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss deleted file mode 100644 index e907edc70..000000000 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.scss +++ /dev/null @@ -1,45 +0,0 @@ -@import 'variables'; -@import 'mixins'; - -$width-size: 190px; - -.peertube-select-container { - @include peertube-select-container($width-size); -} - -.alert.alert-danger { - text-align: center; - - & > div { - font-weight: $font-semibold; - } -} - -.import-video-url { - display: flex; - flex-direction: column; - align-items: center; - - .icon.icon-upload { - @include icon(90px); - margin-bottom: 25px; - cursor: default; - - background-image: url('../../../../assets/images/video/upload.svg'); - } - - input[type=text] { - @include peertube-input-text($width-size); - display: block; - } - - input[type=button] { - @include peertube-button; - @include orange-button; - - width: $width-size; - margin-top: 30px; - } -} - - diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index a1810b7a0..257c6e5db 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -18,7 +18,7 @@ import { scrollToTop } from '@app/shared/misc/utils' templateUrl: './video-import-url.component.html', styleUrls: [ '../shared/video-edit.component.scss', - './video-import-url.component.scss' + './video-send.scss' ] }) export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate { diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.scss b/client/src/app/videos/+video-edit/video-add-components/video-send.scss new file mode 100644 index 000000000..8769dd302 --- /dev/null +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.scss @@ -0,0 +1,54 @@ +@import 'variables'; +@import 'mixins'; + +$width-size: 190px; + +.alert.alert-danger { + text-align: center; + + & > div { + font-weight: $font-semibold; + } +} + +.first-step-block { + display: flex; + flex-direction: column; + align-items: center; + + .upload-icon { + width: 90px; + margin-bottom: 25px; + + @include apply-svg-color(#C6C6C6); + } + + .peertube-select-container { + @include peertube-select-container($width-size); + } + + input[type=text] { + @include peertube-input-text($width-size); + display: block; + } + + input[type=button] { + @include peertube-button; + @include orange-button; + + width: $width-size; + margin-top: 30px; + } + + .button-file { + @include peertube-button-file(auto); + + min-width: 190px; + } + + .button-file-extension { + display: block; + font-size: 12px; + margin-top: 5px; + } +} diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index 826e54d25..b252cd60a 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html @@ -1,6 +1,6 @@
-
-
+
+
Select the file to upload @@ -61,7 +61,7 @@ (click)="updateSecondStep()" [ngClass]="{ disabled: isPublishingButtonDisabled() }" > - +
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss index 4b2c86ae9..8adf8f169 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.scss @@ -1,47 +1,9 @@ @import 'variables'; @import 'mixins'; -.peertube-select-container { - @include peertube-select-container(190px); -} - -.alert.alert-danger { - text-align: center; - - & > div { - font-weight: $font-semibold; - } -} - -.upload-video { - display: flex; - flex-direction: column; - align-items: center; - - .form-group-channel { - margin-bottom: 20px; - margin-top: 35px; - } - - .icon.icon-upload { - @include icon(90px); - margin-bottom: 25px; - cursor: default; - - background-image: url('../../../../assets/images/video/upload.svg'); - } - - .button-file { - @include peertube-button-file(auto); - - min-width: 190px; - } - - .button-file-extension { - display: block; - font-size: 12px; - margin-top: 5px; - } +.first-step-block .form-group-channel { + margin-bottom: 20px; + margin-top: 35px; } .upload-progress-cancel { 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 aa40f8781..e4d54b654 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 @@ -20,7 +20,8 @@ import { scrollToTop } from '@app/shared/misc/utils' templateUrl: './video-upload.component.html', styleUrls: [ '../shared/video-edit.component.scss', - './video-upload.component.scss' + './video-upload.component.scss', + './video-send.scss' ] }) export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate { -- cgit v1.2.3