aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts94
-rw-r--r--client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts8
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts26
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.module.ts16
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts18
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts20
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-send.ts16
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts19
-rw-r--r--client/src/app/videos/+video-edit/video-add-routing.module.ts5
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts9
-rw-r--r--client/src/app/videos/+video-edit/video-add.module.ts23
-rw-r--r--client/src/app/videos/+video-edit/video-update-routing.module.ts7
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts12
-rw-r--r--client/src/app/videos/+video-edit/video-update.module.ts13
-rw-r--r--client/src/app/videos/+video-edit/video-update.resolver.ts8
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.ts15
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts4
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.ts14
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.model.ts7
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts17
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts21
-rw-r--r--client/src/app/videos/+video-watch/modal/video-share.component.ts8
-rw-r--r--client/src/app/videos/+video-watch/modal/video-support.component.ts4
-rw-r--r--client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts39
-rw-r--r--client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts28
-rw-r--r--client/src/app/videos/+video-watch/video-watch-playlist.component.ts13
-rw-r--r--client/src/app/videos/+video-watch/video-watch-routing.module.ts2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts42
-rw-r--r--client/src/app/videos/+video-watch/video-watch.module.ts34
-rw-r--r--client/src/app/videos/recommendations/recent-videos-recommendation.service.ts10
-rw-r--r--client/src/app/videos/recommendations/recommendation-info.model.ts4
-rw-r--r--client/src/app/videos/recommendations/recommendations.module.ts19
-rw-r--r--client/src/app/videos/recommendations/recommendations.service.ts4
-rw-r--r--client/src/app/videos/recommendations/recommended-videos.component.ts15
-rw-r--r--client/src/app/videos/recommendations/recommended-videos.store.ts12
-rw-r--r--client/src/app/videos/video-list/index.ts1
-rw-r--r--client/src/app/videos/video-list/overview/index.ts3
-rw-r--r--client/src/app/videos/video-list/overview/overview.service.ts78
-rw-r--r--client/src/app/videos/video-list/overview/video-overview.component.html (renamed from client/src/app/videos/video-list/video-overview.component.html)0
-rw-r--r--client/src/app/videos/video-list/overview/video-overview.component.scss (renamed from client/src/app/videos/video-list/video-overview.component.scss)0
-rw-r--r--client/src/app/videos/video-list/overview/video-overview.component.ts (renamed from client/src/app/videos/video-list/video-overview.component.ts)10
-rw-r--r--client/src/app/videos/video-list/overview/videos-overview.model.ts20
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts22
-rw-r--r--client/src/app/videos/video-list/video-most-liked.component.ts20
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts20
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts20
-rw-r--r--client/src/app/videos/video-list/video-user-subscriptions.component.ts25
-rw-r--r--client/src/app/videos/videos-routing.module.ts4
-rw-r--r--client/src/app/videos/videos.module.ts21
49 files changed, 523 insertions, 327 deletions
diff --git a/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts
new file mode 100644
index 000000000..b05852ff8
--- /dev/null
+++ b/client/src/app/videos/+video-edit/shared/i18n-primeng-calendar.service.ts
@@ -0,0 +1,94 @@
1import { I18n } from '@ngx-translate/i18n-polyfill'
2import { Injectable } from '@angular/core'
3
4@Injectable()
5export class I18nPrimengCalendarService {
6 private readonly calendarLocale: any = {}
7
8 constructor (private i18n: I18n) {
9 this.calendarLocale = {
10 firstDayOfWeek: 0,
11 dayNames: [
12 this.i18n('Sunday'),
13 this.i18n('Monday'),
14 this.i18n('Tuesday'),
15 this.i18n('Wednesday'),
16 this.i18n('Thursday'),
17 this.i18n('Friday'),
18 this.i18n('Saturday')
19 ],
20
21 dayNamesShort: [
22 this.i18n({ value: 'Sun', description: 'Day name short' }),
23 this.i18n({ value: 'Mon', description: 'Day name short' }),
24 this.i18n({ value: 'Tue', description: 'Day name short' }),
25 this.i18n({ value: 'Wed', description: 'Day name short' }),
26 this.i18n({ value: 'Thu', description: 'Day name short' }),
27 this.i18n({ value: 'Fri', description: 'Day name short' }),
28 this.i18n({ value: 'Sat', description: 'Day name short' })
29 ],
30
31 dayNamesMin: [
32 this.i18n({ value: 'Su', description: 'Day name min' }),
33 this.i18n({ value: 'Mo', description: 'Day name min' }),
34 this.i18n({ value: 'Tu', description: 'Day name min' }),
35 this.i18n({ value: 'We', description: 'Day name min' }),
36 this.i18n({ value: 'Th', description: 'Day name min' }),
37 this.i18n({ value: 'Fr', description: 'Day name min' }),
38 this.i18n({ value: 'Sa', description: 'Day name min' })
39 ],
40
41 monthNames: [
42 this.i18n('January'),
43 this.i18n('February'),
44 this.i18n('March'),
45 this.i18n('April'),
46 this.i18n('May'),
47 this.i18n('June'),
48 this.i18n('July'),
49 this.i18n('August'),
50 this.i18n('September'),
51 this.i18n('October'),
52 this.i18n('November'),
53 this.i18n('December')
54 ],
55
56 monthNamesShort: [
57 this.i18n({ value: 'Jan', description: 'Month name short' }),
58 this.i18n({ value: 'Feb', description: 'Month name short' }),
59 this.i18n({ value: 'Mar', description: 'Month name short' }),
60 this.i18n({ value: 'Apr', description: 'Month name short' }),
61 this.i18n({ value: 'May', description: 'Month name short' }),
62 this.i18n({ value: 'Jun', description: 'Month name short' }),
63 this.i18n({ value: 'Jul', description: 'Month name short' }),
64 this.i18n({ value: 'Aug', description: 'Month name short' }),
65 this.i18n({ value: 'Sep', description: 'Month name short' }),
66 this.i18n({ value: 'Oct', description: 'Month name short' }),
67 this.i18n({ value: 'Nov', description: 'Month name short' }),
68 this.i18n({ value: 'Dec', description: 'Month name short' })
69 ],
70
71 today: this.i18n('Today'),
72
73 clear: this.i18n('Clear')
74 }
75 }
76
77 getCalendarLocale () {
78 return this.calendarLocale
79 }
80
81 getTimezone () {
82 const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]
83 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
84
85 return `${timezone} - ${gmt}`
86 }
87
88 getDateFormat () {
89 return this.i18n({
90 value: 'yy-mm-dd ',
91 description: 'Date format in this locale.'
92 })
93 }
94}
diff --git a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
index 9856aac9e..a90d04ce8 100644
--- a/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -1,11 +1,9 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { FormReactive } from '@app/shared'
3import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
4import { VideoCaptionsValidatorsService } from '@app/shared/forms/form-validators/video-captions-validators.service'
5import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
6import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 3import { FormReactive, FormValidatorService, VideoCaptionsValidatorsService } from '@app/shared/shared-forms'
4import { VideoCaptionEdit } from '@app/shared/shared-main'
7import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 5import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
8import { ServerConfig, VideoConstant } from '../../../../../../shared' 6import { ServerConfig, VideoConstant } from '@shared/models'
9 7
10@Component({ 8@Component({
11 selector: 'my-video-caption-add-modal', 9 selector: 'my-video-caption-add-modal',
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index 15073fc44..239e453ad 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -1,19 +1,13 @@
1import { map } from 'rxjs/operators'
1import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 2import { Component, Input, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' 3import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 4import { ServerService } from '@app/core'
4import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' 5import { removeElementFromArray } from '@app/helpers'
5import { Notifier } from '@app/core' 6import { FormReactiveValidationMessages, FormValidatorService, VideoValidatorsService } from '@app/shared/shared-forms'
6import { ServerService } from '../../../core/server' 7import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
7import { VideoEdit } from '../../../shared/video/video-edit.model' 8import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
8import { map } from 'rxjs/operators' 9import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 10import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
10import { I18nPrimengCalendarService } from '@app/shared/i18n/i18n-primeng-calendar'
11import { VideoCaptionService } from '@app/shared/video-caption'
12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component'
13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
14import { removeElementFromArray } from '@app/shared/misc/utils'
15import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared'
16import { VideoService } from '@app/shared/video/video.service'
17 11
18@Component({ 12@Component({
19 selector: 'my-video-edit', 13 selector: 'my-video-edit',
@@ -60,11 +54,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
60 constructor ( 54 constructor (
61 private formValidatorService: FormValidatorService, 55 private formValidatorService: FormValidatorService,
62 private videoValidatorsService: VideoValidatorsService, 56 private videoValidatorsService: VideoValidatorsService,
63 private videoCaptionService: VideoCaptionService,
64 private videoService: VideoService, 57 private videoService: VideoService,
65 private route: ActivatedRoute,
66 private router: Router,
67 private notifier: Notifier,
68 private serverService: ServerService, 58 private serverService: ServerService,
69 private i18nPrimengCalendarService: I18nPrimengCalendarService, 59 private i18nPrimengCalendarService: I18nPrimengCalendarService,
70 private ngZone: NgZone 60 private ngZone: NgZone
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.module.ts b/client/src/app/videos/+video-edit/shared/video-edit.module.ts
index 1357d607c..96061a300 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.module.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.module.ts
@@ -1,16 +1,20 @@
1import { NgModule } from '@angular/core'
2import { TagInputModule } from 'ngx-chips' 1import { TagInputModule } from 'ngx-chips'
3import { SharedModule } from '../../../shared/'
4import { VideoEditComponent } from './video-edit.component'
5import { CalendarModule } from 'primeng/calendar' 2import { CalendarModule } from 'primeng/calendar'
3import { NgModule } from '@angular/core'
4import { SharedFormModule } from '@app/shared/shared-forms'
5import { SharedGlobalIconModule } from '@app/shared/shared-icons'
6import { SharedMainModule } from '@app/shared/shared-main'
6import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' 7import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
8import { VideoEditComponent } from './video-edit.component'
7 9
8@NgModule({ 10@NgModule({
9 imports: [ 11 imports: [
10 TagInputModule, 12 TagInputModule,
11 CalendarModule, 13 CalendarModule,
12 14
13 SharedModule 15 SharedMainModule,
16 SharedFormModule,
17 SharedGlobalIconModule
14 ], 18 ],
15 19
16 declarations: [ 20 declarations: [
@@ -22,6 +26,10 @@ import { VideoCaptionAddModalComponent } from './video-caption-add-modal.compone
22 TagInputModule, 26 TagInputModule,
23 CalendarModule, 27 CalendarModule,
24 28
29 SharedMainModule,
30 SharedFormModule,
31 SharedGlobalIconModule,
32
25 VideoEditComponent 33 VideoEditComponent
26 ], 34 ],
27 35
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 4d0b0b080..5b453a1d9 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,17 +1,13 @@
1import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' 3import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
4import { AuthService, Notifier, ServerService } from '../../../core' 4import { scrollToTop } from '@app/helpers'
5import { VideoService } from '../../../shared/video/video.service' 5import { FormValidatorService } from '@app/shared/shared-forms'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
7import { LoadingBarService } from '@ngx-loading-bar/core'
8import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' 7import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
9import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 8import { LoadingBarService } from '@ngx-loading-bar/core'
10import { VideoEdit } from '@app/shared/video/video-edit.model' 9import { I18n } from '@ngx-translate/i18n-polyfill'
11import { FormValidatorService } from '@app/shared' 10import { VideoPrivacy, VideoUpdate } from '@shared/models'
12import { VideoCaptionService } from '@app/shared/video-caption'
13import { VideoImportService } from '@app/shared/video-import'
14import { scrollToTop } from '@app/shared/misc/utils'
15 11
16@Component({ 12@Component({
17 selector: 'my-video-import-torrent', 13 selector: 'my-video-import-torrent',
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 213c42333..d0bd1f54d 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,18 +1,14 @@
1import { map, switchMap } from 'rxjs/operators'
1import { Component, EventEmitter, OnInit, Output } from '@angular/core' 2import { Component, EventEmitter, OnInit, Output } from '@angular/core'
2import { Router } from '@angular/router' 3import { Router } from '@angular/router'
3import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' 4import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
4import { AuthService, Notifier, ServerService } from '../../../core' 5import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
5import { VideoService } from '../../../shared/video/video.service' 6import { FormValidatorService } from '@app/shared/shared-forms'
6import { I18n } from '@ngx-translate/i18n-polyfill' 7import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
7import { LoadingBarService } from '@ngx-loading-bar/core'
8import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' 8import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
9import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { VideoEdit } from '@app/shared/video/video-edit.model' 10import { I18n } from '@ngx-translate/i18n-polyfill'
11import { FormValidatorService } from '@app/shared' 11import { VideoPrivacy, VideoUpdate } from '@shared/models'
12import { VideoCaptionService } from '@app/shared/video-caption'
13import { VideoImportService } from '@app/shared/video-import'
14import { scrollToTop, getAbsoluteAPIUrl } from '@app/shared/misc/utils'
15import { switchMap, map } from 'rxjs/operators'
16 12
17@Component({ 13@Component({
18 selector: 'my-video-import-url', 14 selector: 'my-video-import-url',
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 b32f16950..94479321d 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,15 +1,11 @@
1import { catchError, switchMap, tap } from 'rxjs/operators'
1import { EventEmitter, OnInit } from '@angular/core' 2import { EventEmitter, OnInit } from '@angular/core'
3import { AuthService, CanComponentDeactivateResult, Notifier, ServerService } from '@app/core'
4import { populateAsyncUserVideoChannels } from '@app/helpers'
5import { FormReactive } from '@app/shared/shared-forms'
6import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
2import { LoadingBarService } from '@ngx-loading-bar/core' 7import { LoadingBarService } from '@ngx-loading-bar/core'
3import { AuthService, Notifier, ServerService } from '@app/core' 8import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
4import { catchError, switchMap, tap } from 'rxjs/operators'
5import { FormReactive } from '@app/shared'
6import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared'
7import { VideoService } from '@app/shared/video/video.service'
8import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
9import { VideoCaptionService } from '@app/shared/video-caption'
10import { VideoEdit } from '@app/shared/video/video-edit.model'
11import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils'
12import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate-guard.service'
13 9
14export abstract class VideoSend extends FormReactive implements OnInit { 10export abstract class VideoSend extends FormReactive implements OnInit {
15 userVideoChannels: { id: number, label: string, support: string }[] = [] 11 userVideoChannels: { id: number, label: string, support: string }[] = []
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 9ce3fbc6d..eb7ac32ae 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,19 +1,16 @@
1import { BytesPipe } from 'ngx-pipes'
2import { Subscription } from 'rxjs'
1import { HttpEventType, HttpResponse } from '@angular/common/http' 3import { HttpEventType, HttpResponse } from '@angular/common/http'
2import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' 4import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
3import { Router } from '@angular/router' 5import { Router } from '@angular/router'
6import { AuthService, CanComponentDeactivate, Notifier, ServerService, UserService } from '@app/core'
7import { scrollToTop } from '@app/helpers'
8import { FormValidatorService } from '@app/shared/shared-forms'
9import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
10import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send'
4import { LoadingBarService } from '@ngx-loading-bar/core' 11import { LoadingBarService } from '@ngx-loading-bar/core'
5import { BytesPipe } from 'ngx-pipes'
6import { Subscription } from 'rxjs'
7import { VideoPrivacy } from '../../../../../../shared/models/videos'
8import { AuthService, Notifier, ServerService } from '../../../core'
9import { VideoEdit } from '../../../shared/video/video-edit.model'
10import { VideoService } from '../../../shared/video/video.service'
11import { I18n } from '@ngx-translate/i18n-polyfill' 12import { I18n } from '@ngx-translate/i18n-polyfill'
12import { VideoSend } from '@app/videos/+video-edit/video-add-components/video-send' 13import { VideoPrivacy } from '@shared/models'
13import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
14import { FormValidatorService, UserService } from '@app/shared'
15import { VideoCaptionService } from '@app/shared/video-caption'
16import { scrollToTop } from '@app/shared/misc/utils'
17 14
18@Component({ 15@Component({
19 selector: 'my-video-upload', 16 selector: 'my-video-upload',
diff --git a/client/src/app/videos/+video-edit/video-add-routing.module.ts b/client/src/app/videos/+video-edit/video-add-routing.module.ts
index e0fef7158..9ff66bea0 100644
--- a/client/src/app/videos/+video-edit/video-add-routing.module.ts
+++ b/client/src/app/videos/+video-edit/video-add-routing.module.ts
@@ -1,10 +1,7 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3 3import { CanDeactivateGuard, LoginGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
5
6import { LoginGuard } from '../../core'
7import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service'
8import { VideoAddComponent } from './video-add.component' 5import { VideoAddComponent } from './video-add.component'
9 6
10const videoAddRoutes: Routes = [ 7const videoAddRoutes: Routes = [
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts
index 30ab08ea0..5bd768809 100644
--- a/client/src/app/videos/+video-edit/video-add.component.ts
+++ b/client/src/app/videos/+video-edit/video-add.component.ts
@@ -1,10 +1,9 @@
1import { Component, HostListener, OnInit, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 2import { AuthService, CanComponentDeactivate, ServerService } from '@app/core'
3import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
5import { AuthService, ServerService } from '@app/core'
6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
7import { ServerConfig } from '@shared/models' 3import { ServerConfig } from '@shared/models'
4import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'
5import { VideoImportUrlComponent } from './video-add-components/video-import-url.component'
6import { VideoUploadComponent } from './video-add-components/video-upload.component'
8 7
9@Component({ 8@Component({
10 selector: 'my-videos-add', 9 selector: 'my-videos-add',
diff --git a/client/src/app/videos/+video-edit/video-add.module.ts b/client/src/app/videos/+video-edit/video-add.module.ts
index b8f5a9a47..477c1cf5e 100644
--- a/client/src/app/videos/+video-edit/video-add.module.ts
+++ b/client/src/app/videos/+video-edit/video-add.module.ts
@@ -1,20 +1,20 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { SharedModule } from '../../shared' 2import { CanDeactivateGuard } from '@app/core'
3import { VideoEditModule } from './shared/video-edit.module' 3import { VideoEditModule } from './shared/video-edit.module'
4import { DragDropDirective } from './video-add-components/drag-drop.directive'
5import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'
6import { VideoImportUrlComponent } from './video-add-components/video-import-url.component'
7import { VideoUploadComponent } from './video-add-components/video-upload.component'
4import { VideoAddRoutingModule } from './video-add-routing.module' 8import { VideoAddRoutingModule } from './video-add-routing.module'
5import { VideoAddComponent } from './video-add.component' 9import { VideoAddComponent } from './video-add.component'
6import { DragDropDirective } from './video-add-components/drag-drop.directive'
7import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service'
8import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
9import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
10import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
11 10
12@NgModule({ 11@NgModule({
13 imports: [ 12 imports: [
14 VideoAddRoutingModule, 13 VideoAddRoutingModule,
15 VideoEditModule, 14
16 SharedModule 15 VideoEditModule
17 ], 16 ],
17
18 declarations: [ 18 declarations: [
19 VideoAddComponent, 19 VideoAddComponent,
20 VideoUploadComponent, 20 VideoUploadComponent,
@@ -22,10 +22,9 @@ import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-c
22 VideoImportTorrentComponent, 22 VideoImportTorrentComponent,
23 DragDropDirective 23 DragDropDirective
24 ], 24 ],
25 exports: [ 25
26 VideoAddComponent, 26 exports: [ ],
27 DragDropDirective 27
28 ],
29 providers: [ 28 providers: [
30 CanDeactivateGuard 29 CanDeactivateGuard
31 ] 30 ]
diff --git a/client/src/app/videos/+video-edit/video-update-routing.module.ts b/client/src/app/videos/+video-edit/video-update-routing.module.ts
index 564b8fb45..a04351b05 100644
--- a/client/src/app/videos/+video-edit/video-update-routing.module.ts
+++ b/client/src/app/videos/+video-edit/video-update-routing.module.ts
@@ -1,12 +1,9 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3 3import { CanDeactivateGuard, LoginGuard } from '@app/core'
4import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
5
6import { LoginGuard } from '../../core'
7import { VideoUpdateComponent } from './video-update.component' 5import { VideoUpdateComponent } from './video-update.component'
8import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver' 6import { VideoUpdateResolver } from './video-update.resolver'
9import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service'
10 7
11const videoUpdateRoutes: Routes = [ 8const videoUpdateRoutes: Routes = [
12 { 9 {
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 20a607134..7bd6eb553 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -1,17 +1,11 @@
1import { map, switchMap } from 'rxjs/operators' 1import { map, switchMap } from 'rxjs/operators'
2import { Component, HostListener, OnInit } from '@angular/core' 2import { Component, HostListener, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core'
5import { Notifier } from '@app/core' 4import { Notifier } from '@app/core'
6import { ServerService } from '../../core' 5import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
7import { FormReactive } from '../../shared' 6import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
8import { VideoEdit } from '../../shared/video/video-edit.model' 7import { LoadingBarService } from '@ngx-loading-bar/core'
9import { VideoService } from '../../shared/video/video.service'
10import { I18n } from '@ngx-translate/i18n-polyfill' 8import { I18n } from '@ngx-translate/i18n-polyfill'
11import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
12import { VideoCaptionService } from '@app/shared/video-caption'
13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
14import { VideoDetails } from '@app/shared/video/video-details.model'
15import { VideoPrivacy } from '@shared/models' 9import { VideoPrivacy } from '@shared/models'
16 10
17@Component({ 11@Component({
diff --git a/client/src/app/videos/+video-edit/video-update.module.ts b/client/src/app/videos/+video-edit/video-update.module.ts
index d60aa699f..322c69629 100644
--- a/client/src/app/videos/+video-edit/video-update.module.ts
+++ b/client/src/app/videos/+video-edit/video-update.module.ts
@@ -1,25 +1,22 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { SharedModule } from '../../shared' 2import { CanDeactivateGuard } from '@app/core'
3import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver'
3import { VideoEditModule } from './shared/video-edit.module' 4import { VideoEditModule } from './shared/video-edit.module'
4import { VideoUpdateRoutingModule } from './video-update-routing.module' 5import { VideoUpdateRoutingModule } from './video-update-routing.module'
5import { VideoUpdateComponent } from './video-update.component' 6import { VideoUpdateComponent } from './video-update.component'
6import { VideoUpdateResolver } from '@app/videos/+video-edit/video-update.resolver'
7import { CanDeactivateGuard } from '@app/shared/guards/can-deactivate-guard.service'
8 7
9@NgModule({ 8@NgModule({
10 imports: [ 9 imports: [
11 VideoUpdateRoutingModule, 10 VideoUpdateRoutingModule,
12 VideoEditModule, 11
13 SharedModule 12 VideoEditModule
14 ], 13 ],
15 14
16 declarations: [ 15 declarations: [
17 VideoUpdateComponent 16 VideoUpdateComponent
18 ], 17 ],
19 18
20 exports: [ 19 exports: [ ],
21 VideoUpdateComponent
22 ],
23 20
24 providers: [ 21 providers: [
25 VideoUpdateResolver, 22 VideoUpdateResolver,
diff --git a/client/src/app/videos/+video-edit/video-update.resolver.ts b/client/src/app/videos/+video-edit/video-update.resolver.ts
index 4ac517d96..30bcf4d74 100644
--- a/client/src/app/videos/+video-edit/video-update.resolver.ts
+++ b/client/src/app/videos/+video-edit/video-update.resolver.ts
@@ -1,10 +1,8 @@
1import { forkJoin } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators'
1import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
2import { VideoService } from '@app/shared/video/video.service'
3import { ActivatedRouteSnapshot, Resolve } from '@angular/router' 4import { ActivatedRouteSnapshot, Resolve } from '@angular/router'
4import { map, switchMap } from 'rxjs/operators' 5import { VideoCaptionService, VideoChannelService, VideoService } from '@app/shared/shared-main'
5import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
6import { VideoCaptionService } from '@app/shared/video-caption'
7import { forkJoin } from 'rxjs'
8 6
9@Injectable() 7@Injectable()
10export class VideoUpdateResolver implements Resolve<any> { 8export class VideoUpdateResolver implements Resolve<any> {
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
index e1a8f6260..79505c779 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
@@ -1,16 +1,13 @@
1import { Observable } from 'rxjs'
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 2import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { Router } from '@angular/router' 3import { Router } from '@angular/router'
3import { Notifier } from '@app/core' 4import { Notifier, User } from '@app/core'
4import { Observable } from 'rxjs' 5import { FormReactive, FormValidatorService, VideoCommentValidatorsService } from '@app/shared/shared-forms'
5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 6import { Video } from '@app/shared/shared-main'
6import { FormReactive } from '../../../shared' 7import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
7import { User } from '../../../shared/users' 8import { VideoCommentCreate } from '@shared/models'
8import { Video } from '../../../shared/video/video.model'
9import { VideoComment } from './video-comment.model' 9import { VideoComment } from './video-comment.model'
10import { VideoCommentService } from './video-comment.service' 10import { VideoCommentService } from './video-comment.service'
11import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
12import { VideoCommentValidatorsService } from '@app/shared/forms/form-validators/video-comment-validators.service'
13import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
14 11
15@Component({ 12@Component({
16 selector: 'my-video-comment-add', 13 selector: 'my-video-comment-add',
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts
index 1566d7369..7c2aaeadd 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts
@@ -1,5 +1,5 @@
1import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' 1import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models'
2import { VideoComment } from '@app/videos/+video-watch/comment/video-comment.model' 2import { VideoComment } from './video-comment.model'
3 3
4export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { 4export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel {
5 comment: VideoComment 5 comment: VideoComment
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
index 868addd58..27846c1ad 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
@@ -1,15 +1,10 @@
1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
2import { User, UserRight } from '../../../../../../shared/models/users' 2import { MarkdownService, Notifier, UserService } from '@app/core'
3import { AuthService } from '@app/core/auth' 3import { AuthService } from '@app/core/auth'
4import { AccountService } from '@app/shared/account/account.service' 4import { Account, Actor, Video } from '@app/shared/shared-main'
5import { Video } from '@app/shared/video/video.model' 5import { User, UserRight } from '@shared/models'
6import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
6import { VideoComment } from './video-comment.model' 7import { VideoComment } from './video-comment.model'
7import { MarkdownService } from '@app/shared/renderer'
8import { Account } from '@app/shared/account/account.model'
9import { Notifier } from '@app/core'
10import { UserService } from '@app/shared'
11import { Actor } from '@app/shared/actor/actor.model'
12import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model'
13 8
14@Component({ 9@Component({
15 selector: 'my-video-comment', 10 selector: 'my-video-comment',
@@ -40,7 +35,6 @@ export class VideoCommentComponent implements OnInit, OnChanges {
40 constructor ( 35 constructor (
41 private markdownService: MarkdownService, 36 private markdownService: MarkdownService,
42 private authService: AuthService, 37 private authService: AuthService,
43 private accountService: AccountService,
44 private userService: UserService, 38 private userService: UserService,
45 private notifier: Notifier 39 private notifier: Notifier
46 ) {} 40 ) {}
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
index 171fc4acc..e85443196 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
@@ -1,7 +1,6 @@
1import { Account as AccountInterface } from '../../../../../../shared/models/actors' 1import { getAbsoluteAPIUrl } from '@app/helpers'
2import { VideoComment as VideoCommentServerModel, VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 2import { Actor } from '@app/shared/shared-main'
3import { Actor } from '@app/shared/actor/actor.model' 3import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models'
4import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
5 4
6export class VideoComment implements VideoCommentServerModel { 5export class VideoComment implements VideoCommentServerModel {
7 id: number 6 id: number
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
index 0b0715390..a73fb9ca8 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
@@ -1,20 +1,19 @@
1import { Observable } from 'rxjs'
1import { catchError, map } from 'rxjs/operators' 2import { catchError, map } from 'rxjs/operators'
2import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
4import { objectLineFeedToHtml } from '@app/shared/misc/utils' 5import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'
5import { Observable } from 'rxjs' 6import { objectLineFeedToHtml } from '@app/helpers'
6import { FeedFormat, ResultList } from '../../../../../../shared/models'
7import { 7import {
8 FeedFormat,
9 ResultList,
8 VideoComment as VideoCommentServerModel, 10 VideoComment as VideoCommentServerModel,
9 VideoCommentCreate, 11 VideoCommentCreate,
10 VideoCommentThreadTree as VideoCommentThreadTreeServerModel 12 VideoCommentThreadTree as VideoCommentThreadTreeServerModel
11} from '../../../../../../shared/models/videos/video-comment.model' 13} from '@shared/models'
12import { environment } from '../../../../environments/environment' 14import { environment } from '../../../../environments/environment'
13import { RestExtractor, RestService } from '../../../shared/rest' 15import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
14import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model'
15import { CommentSortField } from '../../../shared/video/sort-field.type'
16import { VideoComment } from './video-comment.model' 16import { VideoComment } from './video-comment.model'
17import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model'
18 17
19@Injectable() 18@Injectable()
20export class VideoCommentService { 19export class VideoCommentService {
@@ -52,7 +51,7 @@ export class VideoCommentService {
52 getVideoCommentThreads (parameters: { 51 getVideoCommentThreads (parameters: {
53 videoId: number | string, 52 videoId: number | string,
54 componentPagination: ComponentPaginationLight, 53 componentPagination: ComponentPaginationLight,
55 sort: CommentSortField 54 sort: string
56 }): Observable<ResultList<VideoComment>> { 55 }): Observable<ResultList<VideoComment>> {
57 const { videoId, componentPagination, sort } = parameters 56 const { videoId, componentPagination, sort } = parameters
58 57
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index bba9f1372..df0018ec6 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -1,18 +1,13 @@
1import { Subject, Subscription } from 'rxjs'
1import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' 2import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
2import { ActivatedRoute } from '@angular/router' 3import { ActivatedRoute } from '@angular/router'
3import { ConfirmService, Notifier } from '@app/core' 4import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User } from '@app/core'
4import { Subject, Subscription } from 'rxjs' 5import { HooksService } from '@app/core/plugins/hooks.service'
5import { AuthService } from '../../../core/auth' 6import { Syndication, VideoDetails } from '@app/shared/shared-main'
6import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' 7import { I18n } from '@ngx-translate/i18n-polyfill'
7import { User } from '../../../shared/users' 8import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
8import { CommentSortField } from '../../../shared/video/sort-field.type'
9import { VideoDetails } from '../../../shared/video/video-details.model'
10import { VideoComment } from './video-comment.model' 9import { VideoComment } from './video-comment.model'
11import { VideoCommentService } from './video-comment.service' 10import { VideoCommentService } from './video-comment.service'
12import { I18n } from '@ngx-translate/i18n-polyfill'
13import { Syndication } from '@app/shared/video/syndication.model'
14import { HooksService } from '@app/core/plugins/hooks.service'
15import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model'
16 11
17@Component({ 12@Component({
18 selector: 'my-video-comments', 13 selector: 'my-video-comments',
@@ -28,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
28 23
29 comments: VideoComment[] = [] 24 comments: VideoComment[] = []
30 highlightedThread: VideoComment 25 highlightedThread: VideoComment
31 sort: CommentSortField = '-createdAt' 26 sort = '-createdAt'
32 componentPagination: ComponentPagination = { 27 componentPagination: ComponentPagination = {
33 currentPage: 1, 28 currentPage: 1,
34 itemsPerPage: 10, 29 itemsPerPage: 10,
@@ -154,7 +149,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
154 this.viewReplies(commentTree.comment.id) 149 this.viewReplies(commentTree.comment.id)
155 } 150 }
156 151
157 handleSortChange (sort: CommentSortField) { 152 handleSortChange (sort: string) {
158 if (this.sort === sort) return 153 if (this.sort === sort) return
159 154
160 this.sort = sort 155 this.sort = sort
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts
index 3550556a0..b42b775c1 100644
--- a/client/src/app/videos/+video-watch/modal/video-share.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts
@@ -1,9 +1,9 @@
1import { Component, ElementRef, Input, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { VideoDetails } from '../../../shared/video/video-details.model'
3import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' 2import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { VideoCaption } from '@shared/models' 4import { VideoCaption } from '@shared/models'
6import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' 5import { VideoDetails } from '@app/shared/shared-main'
6import { VideoPlaylist } from '@app/shared/shared-video-playlist'
7 7
8type Customizations = { 8type Customizations = {
9 startAtCheckbox: boolean 9 startAtCheckbox: boolean
@@ -40,13 +40,9 @@ export class VideoShareComponent {
40 isAdvancedCustomizationCollapsed = true 40 isAdvancedCustomizationCollapsed = true
41 includeVideoInPlaylist = false 41 includeVideoInPlaylist = false
42 42
43 private currentVideoTimestamp: number
44
45 constructor (private modalService: NgbModal) { } 43 constructor (private modalService: NgbModal) { }
46 44
47 show (currentVideoTimestamp?: number) { 45 show (currentVideoTimestamp?: number) {
48 this.currentVideoTimestamp = currentVideoTimestamp
49
50 let subtitle: string 46 let subtitle: string
51 if (this.videoCaptions.length !== 0) { 47 if (this.videoCaptions.length !== 0) {
52 subtitle = this.videoCaptions[0].language.id 48 subtitle = this.videoCaptions[0].language.id
diff --git a/client/src/app/videos/+video-watch/modal/video-support.component.ts b/client/src/app/videos/+video-watch/modal/video-support.component.ts
index 0058172f2..48d5f2948 100644
--- a/client/src/app/videos/+video-watch/modal/video-support.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-support.component.ts
@@ -1,7 +1,7 @@
1import { Component, Input, ViewChild } from '@angular/core' 1import { Component, Input, ViewChild } from '@angular/core'
2import { VideoDetails } from '../../../shared/video/video-details.model' 2import { MarkdownService } from '@app/core'
3import { VideoDetails } from '@app/shared/shared-main'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { MarkdownService } from '@app/shared/renderer'
5 5
6@Component({ 6@Component({
7 selector: 'my-video-support', 7 selector: 'my-video-support',
diff --git a/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts b/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts
new file mode 100644
index 000000000..45e023695
--- /dev/null
+++ b/client/src/app/videos/+video-watch/timestamp-route-transformer.directive.ts
@@ -0,0 +1,39 @@
1import { Directive, EventEmitter, HostListener, Output } from '@angular/core'
2
3@Directive({
4 selector: '[timestampRouteTransformer]'
5})
6export class TimestampRouteTransformerDirective {
7 @Output() timestampClicked = new EventEmitter<number>()
8
9 @HostListener('click', ['$event'])
10 public onClick ($event: Event) {
11 const target = $event.target as HTMLLinkElement
12
13 if (target.hasAttribute('href') !== true) return
14
15 const ngxLink = document.createElement('a')
16 ngxLink.href = target.getAttribute('href')
17
18 // we only care about reflective links
19 if (ngxLink.host !== window.location.host) return
20
21 const ngxLinkParams = new URLSearchParams(ngxLink.search)
22 if (ngxLinkParams.has('start') !== true) return
23
24 const separators = ['h', 'm', 's']
25 const start = ngxLinkParams
26 .get('start')
27 .match(new RegExp('(\\d{1,9}[' + separators.join('') + '])','g')) // match digits before any given separator
28 .map(t => {
29 if (t.includes('h')) return parseInt(t, 10) * 3600
30 if (t.includes('m')) return parseInt(t, 10) * 60
31 return parseInt(t, 10)
32 })
33 .reduce((acc, t) => acc + t)
34
35 this.timestampClicked.emit(start)
36
37 $event.preventDefault()
38 }
39}
diff --git a/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts b/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts
new file mode 100644
index 000000000..4b6767415
--- /dev/null
+++ b/client/src/app/videos/+video-watch/video-duration-formatter.pipe.ts
@@ -0,0 +1,28 @@
1import { Pipe, PipeTransform } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
3
4@Pipe({
5 name: 'myVideoDurationFormatter'
6})
7export class VideoDurationPipe implements PipeTransform {
8
9 constructor (private i18n: I18n) {
10
11 }
12
13 transform (value: number): string {
14 const hours = Math.floor(value / 3600)
15 const minutes = Math.floor((value % 3600) / 60)
16 const seconds = value % 60
17
18 if (hours > 0) {
19 return this.i18n('{{hours}} h {{minutes}} min {{seconds}} sec', { hours, minutes, seconds })
20 }
21
22 if (minutes > 0) {
23 return this.i18n('{{minutes}} min {{seconds}} sec', { minutes, seconds })
24 }
25
26 return this.i18n('{{seconds}} sec', { seconds })
27 }
28}
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts
index 827c34d41..2c21be643 100644
--- a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts
@@ -1,15 +1,10 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
2import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
3import { ComponentPagination } from '@app/shared/rest/component-pagination.model'
4import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models'
5import { Router } from '@angular/router' 2import { Router } from '@angular/router'
6import { UserService } from '@app/shared' 3import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core'
7import { AuthService, Notifier } from '@app/core' 4import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers/peertube-web-storage'
8import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' 5import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'
9import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model'
10import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage'
11import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
12import { SessionStorageService, LocalStorageService } from '@app/shared/misc/storage.service' 7import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models'
13 8
14@Component({ 9@Component({
15 selector: 'my-video-watch-playlist', 10 selector: 'my-video-watch-playlist',
diff --git a/client/src/app/videos/+video-watch/video-watch-routing.module.ts b/client/src/app/videos/+video-watch/video-watch-routing.module.ts
index ce9250bdc..d8fecb87d 100644
--- a/client/src/app/videos/+video-watch/video-watch-routing.module.ts
+++ b/client/src/app/videos/+video-watch/video-watch-routing.module.ts
@@ -1,8 +1,6 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3
4import { MetaGuard } from '@ngx-meta/core' 3import { MetaGuard } from '@ngx-meta/core'
5
6import { VideoWatchComponent } from './video-watch.component' 4import { VideoWatchComponent } from './video-watch.component'
7 5
8const videoWatchRoutes: Routes = [ 6const videoWatchRoutes: Routes = [
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index df0c1058c..5b0b34c80 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -1,41 +1,33 @@
1import { Hotkey, HotkeysService } from 'angular2-hotkeys'
2import { forkJoin, Observable, Subscription } from 'rxjs'
1import { catchError } from 'rxjs/operators' 3import { catchError } from 'rxjs/operators'
4import { PlatformLocation } from '@angular/common'
2import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' 5import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 6import { ActivatedRoute, Router } from '@angular/router'
7import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestExtractor, ServerService, UserService } from '@app/core'
8import { HooksService } from '@app/core/plugins/hooks.service'
4import { RedirectService } from '@app/core/routing/redirect.service' 9import { RedirectService } from '@app/core/routing/redirect.service'
5import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' 10import { isXPercentInViewport, peertubeLocalStorage, scrollToTop } from '@app/helpers'
6import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' 11import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main'
12import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
13import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
7import { MetaService } from '@ngx-meta/core' 14import { MetaService } from '@ngx-meta/core'
8import { AuthUser, Notifier, ServerService } from '@app/core'
9import { forkJoin, Observable, Subscription } from 'rxjs'
10import { Hotkey, HotkeysService } from 'angular2-hotkeys'
11import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
12import { AuthService, ConfirmService } from '../../core'
13import { RestExtractor, UserService } from '../../shared'
14import { VideoDetails } from '../../shared/video/video-details.model'
15import { VideoService } from '../../shared/video/video.service'
16import { VideoShareComponent } from './modal/video-share.component'
17import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component'
18import { I18n } from '@ngx-translate/i18n-polyfill' 15import { I18n } from '@ngx-translate/i18n-polyfill'
19import { environment } from '../../../environments/environment' 16import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
20import { VideoCaptionService } from '@app/shared/video-caption' 17import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
21import { MarkdownService } from '@app/shared/renderer'
22import { 18import {
23 videojs,
24 CustomizationOptions, 19 CustomizationOptions,
25 P2PMediaLoaderOptions, 20 P2PMediaLoaderOptions,
26 PeertubePlayerManager, 21 PeertubePlayerManager,
27 PeertubePlayerManagerOptions, 22 PeertubePlayerManagerOptions,
28 PlayerMode 23 PlayerMode,
24 videojs
29} from '../../../assets/player/peertube-player-manager' 25} from '../../../assets/player/peertube-player-manager'
30import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
31import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
32import { Video } from '@app/shared/video/video.model'
33import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' 26import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
34import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' 27import { environment } from '../../../environments/environment'
35import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' 28import { VideoShareComponent } from './modal/video-share.component'
36import { HooksService } from '@app/core/plugins/hooks.service' 29import { VideoSupportComponent } from './modal/video-support.component'
37import { PlatformLocation } from '@angular/common' 30import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
38import { scrollToTop, isXPercentInViewport } from '@app/shared/misc/utils'
39 31
40@Component({ 32@Component({
41 selector: 'my-video-watch', 33 selector: 'my-video-watch',
diff --git a/client/src/app/videos/+video-watch/video-watch.module.ts b/client/src/app/videos/+video-watch/video-watch.module.ts
index 9b445269d..a1c54f065 100644
--- a/client/src/app/videos/+video-watch/video-watch.module.ts
+++ b/client/src/app/videos/+video-watch/video-watch.module.ts
@@ -1,26 +1,40 @@
1import { QRCodeModule } from 'angularx-qrcode'
1import { NgModule } from '@angular/core' 2import { NgModule } from '@angular/core'
2import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' 3import { SharedFormModule } from '@app/shared/shared-forms'
3import { SharedModule } from '../../shared' 4import { SharedGlobalIconModule } from '@app/shared/shared-icons'
5import { SharedMainModule } from '@app/shared/shared-main'
6import { SharedModerationModule } from '@app/shared/shared-moderation'
7import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
8import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
9import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
10import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module'
11import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
4import { VideoCommentAddComponent } from './comment/video-comment-add.component' 12import { VideoCommentAddComponent } from './comment/video-comment-add.component'
5import { VideoCommentComponent } from './comment/video-comment.component' 13import { VideoCommentComponent } from './comment/video-comment.component'
6import { VideoCommentService } from './comment/video-comment.service' 14import { VideoCommentService } from './comment/video-comment.service'
7import { VideoCommentsComponent } from './comment/video-comments.component' 15import { VideoCommentsComponent } from './comment/video-comments.component'
8import { VideoShareComponent } from './modal/video-share.component' 16import { VideoShareComponent } from './modal/video-share.component'
17import { VideoSupportComponent } from './modal/video-support.component'
18import { TimestampRouteTransformerDirective } from './timestamp-route-transformer.directive'
19import { VideoDurationPipe } from './video-duration-formatter.pipe'
20import { VideoWatchPlaylistComponent } from './video-watch-playlist.component'
9import { VideoWatchRoutingModule } from './video-watch-routing.module' 21import { VideoWatchRoutingModule } from './video-watch-routing.module'
10import { VideoWatchComponent } from './video-watch.component' 22import { VideoWatchComponent } from './video-watch.component'
11import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
12import { RecommendationsModule } from '@app/videos/recommendations/recommendations.module'
13import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
14import { QRCodeModule } from 'angularx-qrcode'
15import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestamp-route-transformer.directive'
16 23
17@NgModule({ 24@NgModule({
18 imports: [ 25 imports: [
19 VideoWatchRoutingModule, 26 VideoWatchRoutingModule,
20 SharedModule,
21 NgbTooltipModule, 27 NgbTooltipModule,
22 QRCodeModule, 28 QRCodeModule,
23 RecommendationsModule 29 RecommendationsModule,
30
31 SharedMainModule,
32 SharedFormModule,
33 SharedVideoMiniatureModule,
34 SharedVideoPlaylistModule,
35 SharedUserSubscriptionModule,
36 SharedModerationModule,
37 SharedGlobalIconModule
24 ], 38 ],
25 39
26 declarations: [ 40 declarations: [
@@ -33,6 +47,8 @@ import { TimestampRouteTransformerDirective } from '@app/shared/angular/timestam
33 VideoCommentAddComponent, 47 VideoCommentAddComponent,
34 VideoCommentComponent, 48 VideoCommentComponent,
35 49
50 TimestampRouteTransformerDirective,
51 VideoDurationPipe,
36 TimestampRouteTransformerDirective 52 TimestampRouteTransformerDirective
37 ], 53 ],
38 54
diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts
index 0abf938b7..a376453bf 100644
--- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts
+++ b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts
@@ -1,15 +1,13 @@
1import { Observable, of } from 'rxjs' 1import { Observable, of } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { ServerService } from '@app/core' 4import { ServerService, UserService } from '@app/core'
5import { AdvancedSearch } from '@app/search/advanced-search.model' 5import { AdvancedSearch } from '@app/search/advanced-search.model'
6import { SearchService } from '@app/search/search.service' 6import { SearchService } from '@app/search/search.service'
7import { UserService } from '@app/shared' 7import { Video, VideoService } from '@app/shared/shared-main'
8import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
9import { Video } from '@app/shared/video/video.model'
10import { VideoService } from '@app/shared/video/video.service'
11import { RecommendationService } from '@app/videos/recommendations/recommendations.service'
12import { ServerConfig } from '@shared/models' 8import { ServerConfig } from '@shared/models'
9import { RecommendationInfo } from './recommendation-info.model'
10import { RecommendationService } from './recommendations.service'
13 11
14/** 12/**
15 * Provides "recommendations" by providing the most recently uploaded videos. 13 * Provides "recommendations" by providing the most recently uploaded videos.
diff --git a/client/src/app/videos/recommendations/recommendation-info.model.ts b/client/src/app/videos/recommendations/recommendation-info.model.ts
new file mode 100644
index 000000000..0233563bb
--- /dev/null
+++ b/client/src/app/videos/recommendations/recommendation-info.model.ts
@@ -0,0 +1,4 @@
1export interface RecommendationInfo {
2 uuid: string
3 tags?: string[]
4}
diff --git a/client/src/app/videos/recommendations/recommendations.module.ts b/client/src/app/videos/recommendations/recommendations.module.ts
index 3e279cc29..03cc272ca 100644
--- a/client/src/app/videos/recommendations/recommendations.module.ts
+++ b/client/src/app/videos/recommendations/recommendations.module.ts
@@ -1,16 +1,21 @@
1import { NgModule } from '@angular/core'
2import { InputSwitchModule } from 'primeng/inputswitch' 1import { InputSwitchModule } from 'primeng/inputswitch'
3import { RecommendedVideosComponent } from '@app/videos/recommendations/recommended-videos.component'
4import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store'
5import { CommonModule } from '@angular/common' 2import { CommonModule } from '@angular/common'
6import { SharedModule } from '@app/shared' 3import { NgModule } from '@angular/core'
7import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service' 4import { SharedMainModule } from '@app/shared/shared-main'
5import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
6import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
7import { RecentVideosRecommendationService } from './recent-videos-recommendation.service'
8import { RecommendedVideosComponent } from './recommended-videos.component'
9import { RecommendedVideosStore } from './recommended-videos.store'
8 10
9@NgModule({ 11@NgModule({
10 imports: [ 12 imports: [
13 CommonModule,
11 InputSwitchModule, 14 InputSwitchModule,
12 SharedModule, 15
13 CommonModule 16 SharedMainModule,
17 SharedVideoPlaylistModule,
18 SharedVideoMiniatureModule
14 ], 19 ],
15 declarations: [ 20 declarations: [
16 RecommendedVideosComponent 21 RecommendedVideosComponent
diff --git a/client/src/app/videos/recommendations/recommendations.service.ts b/client/src/app/videos/recommendations/recommendations.service.ts
index a547e289d..1d79d35f6 100644
--- a/client/src/app/videos/recommendations/recommendations.service.ts
+++ b/client/src/app/videos/recommendations/recommendations.service.ts
@@ -1,6 +1,6 @@
1import { Video } from '@app/shared/video/video.model'
2import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
3import { Observable } from 'rxjs' 1import { Observable } from 'rxjs'
2import { Video } from '@app/shared/shared-main'
3import { RecommendationInfo } from './recommendation-info.model'
4 4
5export interface RecommendationService { 5export interface RecommendationService {
6 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> 6 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]>
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts
index a6f3bce3d..016975341 100644
--- a/client/src/app/videos/recommendations/recommended-videos.component.ts
+++ b/client/src/app/videos/recommendations/recommended-videos.component.ts
@@ -1,15 +1,12 @@
1import { Observable } from 'rxjs' 1import { Observable } from 'rxjs'
2import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' 2import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'
3import { AuthService, Notifier } from '@app/core' 3import { AuthService, Notifier, SessionStorageService, User, UserService } from '@app/core'
4import { User } from '@app/shared' 4import { Video } from '@app/shared/shared-main'
5import { SessionStorageService } from '@app/shared/misc/storage.service' 5import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'
6import { UserService } from '@app/shared/users/user.service' 6import { VideoPlaylist } from '@app/shared/shared-video-playlist'
7import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
8import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
9import { MiniatureDisplayOptions } from '@app/shared/video/video-miniature.component'
10import { Video } from '@app/shared/video/video.model'
11import { RecommendedVideosStore } from '@app/videos/recommendations/recommended-videos.store'
12import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { RecommendationInfo } from './recommendation-info.model'
9import { RecommendedVideosStore } from './recommended-videos.store'
13 10
14@Component({ 11@Component({
15 selector: 'my-recommended-videos', 12 selector: 'my-recommended-videos',
diff --git a/client/src/app/videos/recommendations/recommended-videos.store.ts b/client/src/app/videos/recommendations/recommended-videos.store.ts
index 858ec3a27..8c3fb6480 100644
--- a/client/src/app/videos/recommendations/recommended-videos.store.ts
+++ b/client/src/app/videos/recommendations/recommended-videos.store.ts
@@ -1,10 +1,10 @@
1import { Inject, Injectable } from '@angular/core'
2import { Observable, ReplaySubject } from 'rxjs' 1import { Observable, ReplaySubject } from 'rxjs'
3import { Video } from '@app/shared/video/video.model'
4import { RecommendationInfo } from '@app/shared/video/recommendation-info.model'
5import { RecentVideosRecommendationService } from '@app/videos/recommendations/recent-videos-recommendation.service'
6import { RecommendationService } from '@app/videos/recommendations/recommendations.service'
7import { map, shareReplay, switchMap, take } from 'rxjs/operators' 2import { map, shareReplay, switchMap, take } from 'rxjs/operators'
3import { Inject, Injectable } from '@angular/core'
4import { Video } from '@app/shared/shared-main'
5import { RecentVideosRecommendationService } from './recent-videos-recommendation.service'
6import { RecommendationInfo } from './recommendation-info.model'
7import { RecommendationService } from './recommendations.service'
8 8
9/** 9/**
10 * This store is intended to provide data for the RecommendedVideosComponent. 10 * This store is intended to provide data for the RecommendedVideosComponent.
@@ -20,7 +20,7 @@ export class RecommendedVideosStore {
20 ) { 20 ) {
21 this.recommendations$ = this.requestsForLoad$$.pipe( 21 this.recommendations$ = this.requestsForLoad$$.pipe(
22 switchMap(requestedRecommendation => { 22 switchMap(requestedRecommendation => {
23 return recommendations.getRecommendations(requestedRecommendation) 23 return this.recommendations.getRecommendations(requestedRecommendation)
24 .pipe(take(1)) 24 .pipe(take(1))
25 }), 25 }),
26 shareReplay() 26 shareReplay()
diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts
index b367110ae..af1bd58b7 100644
--- a/client/src/app/videos/video-list/index.ts
+++ b/client/src/app/videos/video-list/index.ts
@@ -1,3 +1,4 @@
1export * from './overview'
1export * from './video-local.component' 2export * from './video-local.component'
2export * from './video-recently-added.component' 3export * from './video-recently-added.component'
3export * from './video-trending.component' 4export * from './video-trending.component'
diff --git a/client/src/app/videos/video-list/overview/index.ts b/client/src/app/videos/video-list/overview/index.ts
new file mode 100644
index 000000000..e6cfa4802
--- /dev/null
+++ b/client/src/app/videos/video-list/overview/index.ts
@@ -0,0 +1,3 @@
1export * from './overview.service'
2export * from './video-overview.component'
3export * from './videos-overview.model'
diff --git a/client/src/app/videos/video-list/overview/overview.service.ts b/client/src/app/videos/video-list/overview/overview.service.ts
new file mode 100644
index 000000000..4458454d5
--- /dev/null
+++ b/client/src/app/videos/video-list/overview/overview.service.ts
@@ -0,0 +1,78 @@
1import { forkJoin, Observable, of } from 'rxjs'
2import { catchError, map, switchMap, tap } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core'
5import { RestExtractor, ServerService } from '@app/core'
6import { immutableAssign } from '@app/helpers'
7import { VideoService } from '@app/shared/shared-main'
8import { peertubeTranslate, VideosOverview as VideosOverviewServer } from '@shared/models'
9import { environment } from '../../../../environments/environment'
10import { VideosOverview } from './videos-overview.model'
11
12@Injectable()
13export class OverviewService {
14 static BASE_OVERVIEW_URL = environment.apiUrl + '/api/v1/overviews/'
15
16 constructor (
17 private authHttp: HttpClient,
18 private restExtractor: RestExtractor,
19 private videosService: VideoService,
20 private serverService: ServerService
21 ) {}
22
23 getVideosOverview (page: number): Observable<VideosOverview> {
24 let params = new HttpParams()
25 params = params.append('page', page + '')
26
27 return this.authHttp
28 .get<VideosOverviewServer>(OverviewService.BASE_OVERVIEW_URL + 'videos', { params })
29 .pipe(
30 switchMap(serverVideosOverview => this.updateVideosOverview(serverVideosOverview)),
31 catchError(err => this.restExtractor.handleError(err))
32 )
33 }
34
35 private updateVideosOverview (serverVideosOverview: VideosOverviewServer): Observable<VideosOverview> {
36 const observables: Observable<any>[] = []
37 const videosOverviewResult: VideosOverview = {
38 tags: [],
39 categories: [],
40 channels: []
41 }
42
43 // Build videos objects
44 for (const key of Object.keys(serverVideosOverview)) {
45 for (const object of serverVideosOverview[ key ]) {
46 observables.push(
47 of(object.videos)
48 .pipe(
49 switchMap(videos => this.videosService.extractVideos({ total: 0, data: videos })),
50 map(result => result.data),
51 tap(videos => {
52 videosOverviewResult[key].push(immutableAssign(object, { videos }))
53 })
54 )
55 )
56 }
57 }
58
59 if (observables.length === 0) return of(videosOverviewResult)
60
61 return forkJoin(observables)
62 .pipe(
63 // Translate categories
64 switchMap(() => {
65 return this.serverService.getServerLocale()
66 .pipe(
67 tap(translations => {
68 for (const c of videosOverviewResult.categories) {
69 c.category.label = peertubeTranslate(c.category.label, translations)
70 }
71 })
72 )
73 }),
74 map(() => videosOverviewResult)
75 )
76 }
77
78}
diff --git a/client/src/app/videos/video-list/video-overview.component.html b/client/src/app/videos/video-list/overview/video-overview.component.html
index ca986c634..ca986c634 100644
--- a/client/src/app/videos/video-list/video-overview.component.html
+++ b/client/src/app/videos/video-list/overview/video-overview.component.html
diff --git a/client/src/app/videos/video-list/video-overview.component.scss b/client/src/app/videos/video-list/overview/video-overview.component.scss
index c1d10188a..c1d10188a 100644
--- a/client/src/app/videos/video-list/video-overview.component.scss
+++ b/client/src/app/videos/video-list/overview/video-overview.component.scss
diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/overview/video-overview.component.ts
index 8ff8400db..b3be1d7b5 100644
--- a/client/src/app/videos/video-list/video-overview.component.ts
+++ b/client/src/app/videos/video-list/overview/video-overview.component.ts
@@ -1,11 +1,9 @@
1import { Subject } from 'rxjs' 1import { Subject } from 'rxjs'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { Notifier } from '@app/core' 3import { Notifier, ScreenService, User, UserService } from '@app/core'
4import { User, UserService } from '@app/shared' 4import { Video } from '@app/shared/shared-main'
5import { ScreenService } from '@app/shared/misc/screen.service' 5import { OverviewService } from './overview.service'
6import { OverviewService } from '@app/shared/overview' 6import { VideosOverview } from './videos-overview.model'
7import { VideosOverview } from '@app/shared/overview/videos-overview.model'
8import { Video } from '@app/shared/video/video.model'
9 7
10@Component({ 8@Component({
11 selector: 'my-video-overview', 9 selector: 'my-video-overview',
diff --git a/client/src/app/videos/video-list/overview/videos-overview.model.ts b/client/src/app/videos/video-list/overview/videos-overview.model.ts
new file mode 100644
index 000000000..6765ad9b7
--- /dev/null
+++ b/client/src/app/videos/video-list/overview/videos-overview.model.ts
@@ -0,0 +1,20 @@
1import { Video } from '@app/shared/shared-main'
2import { VideoChannelSummary, VideoConstant, VideosOverview as VideosOverviewServer } from '@shared/models'
3
4export class VideosOverview implements VideosOverviewServer {
5 channels: {
6 channel: VideoChannelSummary
7 videos: Video[]
8 }[]
9
10 categories: {
11 category: VideoConstant<number>
12 videos: Video[]
13 }[]
14
15 tags: {
16 tag: string
17 videos: Video[]
18 }[]
19 [key: string]: any
20}
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts
index 960523cd7..b4c71ac49 100644
--- a/client/src/app/videos/video-list/video-local.component.ts
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -1,23 +1,17 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { ScreenService } from '@app/shared/misc/screen.service'
11import { UserRight } from '../../../../../shared/models/users'
12import { Notifier, ServerService } from '@app/core'
13import { HooksService } from '@app/core/plugins/hooks.service' 4import { HooksService } from '@app/core/plugins/hooks.service'
14import { UserService } from '@app/shared' 5import { immutableAssign } from '@app/helpers'
15import { LocalStorageService } from '@app/shared/misc/storage.service' 6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { UserRight, VideoFilter, VideoSortField } from '@shared/models'
16 10
17@Component({ 11@Component({
18 selector: 'my-videos-local', 12 selector: 'my-videos-local',
19 styleUrls: [ '../../shared/video/abstract-video-list.scss' ], 13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
20 templateUrl: '../../shared/video/abstract-video-list.html' 14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
21}) 15})
22export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { 16export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
23 titlePage: string 17 titlePage: string
diff --git a/client/src/app/videos/video-list/video-most-liked.component.ts b/client/src/app/videos/video-list/video-most-liked.component.ts
index cc91a2330..ca14851bb 100644
--- a/client/src/app/videos/video-list/video-most-liked.component.ts
+++ b/client/src/app/videos/video-list/video-most-liked.component.ts
@@ -1,21 +1,17 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { Notifier, ServerService } from '@app/core'
11import { HooksService } from '@app/core/plugins/hooks.service' 4import { HooksService } from '@app/core/plugins/hooks.service'
12import { UserService } from '@app/shared' 5import { immutableAssign } from '@app/helpers'
13import { LocalStorageService } from '@app/shared/misc/storage.service' 6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { VideoSortField } from '@shared/models'
14 10
15@Component({ 11@Component({
16 selector: 'my-videos-most-liked', 12 selector: 'my-videos-most-liked',
17 styleUrls: [ '../../shared/video/abstract-video-list.scss' ], 13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
18 templateUrl: '../../shared/video/abstract-video-list.html' 14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
19}) 15})
20export class VideoMostLikedComponent extends AbstractVideoList implements OnInit { 16export class VideoMostLikedComponent extends AbstractVideoList implements OnInit {
21 titlePage: string 17 titlePage: string
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts
index 9f57a61e3..c9395133f 100644
--- a/client/src/app/videos/video-list/video-recently-added.component.ts
+++ b/client/src/app/videos/video-list/video-recently-added.component.ts
@@ -1,21 +1,17 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { Notifier, ServerService } from '@app/core'
11import { HooksService } from '@app/core/plugins/hooks.service' 4import { HooksService } from '@app/core/plugins/hooks.service'
12import { UserService } from '@app/shared' 5import { immutableAssign } from '@app/helpers'
13import { LocalStorageService } from '@app/shared/misc/storage.service' 6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { VideoSortField } from '@shared/models'
14 10
15@Component({ 11@Component({
16 selector: 'my-videos-recently-added', 12 selector: 'my-videos-recently-added',
17 styleUrls: [ '../../shared/video/abstract-video-list.scss' ], 13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
18 templateUrl: '../../shared/video/abstract-video-list.html' 14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
19}) 15})
20export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { 16export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
21 titlePage: string 17 titlePage: string
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index 62e0f4e69..10eab18de 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -1,21 +1,17 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { Notifier, ServerService } from '@app/core'
11import { HooksService } from '@app/core/plugins/hooks.service' 4import { HooksService } from '@app/core/plugins/hooks.service'
12import { UserService } from '@app/shared' 5import { immutableAssign } from '@app/helpers'
13import { LocalStorageService } from '@app/shared/misc/storage.service' 6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { VideoSortField } from '@shared/models'
14 10
15@Component({ 11@Component({
16 selector: 'my-videos-trending', 12 selector: 'my-videos-trending',
17 styleUrls: [ '../../shared/video/abstract-video-list.scss' ], 13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
18 templateUrl: '../../shared/video/abstract-video-list.html' 14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
19}) 15})
20export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { 16export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
21 titlePage: string 17 titlePage: string
diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts
index 036fd8dcb..41ad9b277 100644
--- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts
+++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts
@@ -1,22 +1,18 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4import { AuthService } from '../../core/auth'
5import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6import { VideoSortField } from '../../shared/video/sort-field.type'
7import { VideoService } from '../../shared/video/video.service'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { ScreenService } from '@app/shared/misc/screen.service'
10import { OwnerDisplayType } from '@app/shared/video/video-miniature.component'
11import { Notifier, ServerService } from '@app/core'
12import { HooksService } from '@app/core/plugins/hooks.service' 4import { HooksService } from '@app/core/plugins/hooks.service'
13import { UserService } from '@app/shared' 5import { immutableAssign } from '@app/helpers'
14import { LocalStorageService } from '@app/shared/misc/storage.service' 6import { VideoService } from '@app/shared/shared-main'
7import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
8import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature'
9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { VideoSortField } from '@shared/models'
15 11
16@Component({ 12@Component({
17 selector: 'my-videos-user-subscriptions', 13 selector: 'my-videos-user-subscriptions',
18 styleUrls: [ '../../shared/video/abstract-video-list.scss' ], 14 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
19 templateUrl: '../../shared/video/abstract-video-list.html' 15 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
20}) 16})
21export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { 17export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
22 titlePage: string 18 titlePage: string
@@ -34,6 +30,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
34 protected userService: UserService, 30 protected userService: UserService,
35 protected screenService: ScreenService, 31 protected screenService: ScreenService,
36 protected storageService: LocalStorageService, 32 protected storageService: LocalStorageService,
33 private userSubscription: UserSubscriptionService,
37 private videoService: VideoService, 34 private videoService: VideoService,
38 private hooks: HooksService 35 private hooks: HooksService
39 ) { 36 ) {
@@ -64,7 +61,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement
64 } 61 }
65 62
66 return this.hooks.wrapObsFun( 63 return this.hooks.wrapObsFun(
67 this.videoService.getUserSubscriptionVideos.bind(this.videoService), 64 this.userSubscription.getUserSubscriptionVideos.bind(this.userSubscription),
68 params, 65 params,
69 'common', 66 'common',
70 'filter:api.user-subscriptions-videos.videos.list.params', 67 'filter:api.user-subscriptions-videos.videos.list.params',
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index 11a087d0a..16b65be63 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -6,8 +6,8 @@ import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.c
6import { VideoTrendingComponent } from './video-list/video-trending.component' 6import { VideoTrendingComponent } from './video-list/video-trending.component'
7import { VideoMostLikedComponent } from './video-list/video-most-liked.component' 7import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
8import { VideosComponent } from './videos.component' 8import { VideosComponent } from './videos.component'
9import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component' 9import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component'
10import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component' 10import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
11 11
12const videosRoutes: Routes = [ 12const videosRoutes: Routes = [
13 { 13 {
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts
index 95078a734..217e5bb50 100644
--- a/client/src/app/videos/videos.module.ts
+++ b/client/src/app/videos/videos.module.ts
@@ -1,18 +1,27 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' 2import { SharedFormModule } from '@app/shared/shared-forms'
3import { SharedModule } from '../shared' 3import { SharedGlobalIconModule } from '@app/shared/shared-icons'
4import { SharedMainModule } from '@app/shared/shared-main'
5import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
6import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
7import { VideoOverviewComponent } from './video-list/overview/video-overview.component'
8import { VideoLocalComponent } from './video-list/video-local.component'
9import { VideoMostLikedComponent } from './video-list/video-most-liked.component'
4import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 10import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
5import { VideoTrendingComponent } from './video-list/video-trending.component' 11import { VideoTrendingComponent } from './video-list/video-trending.component'
6import { VideoMostLikedComponent } from './video-list/video-most-liked.component' 12import { VideoUserSubscriptionsComponent } from './video-list/video-user-subscriptions.component'
7import { VideosRoutingModule } from './videos-routing.module' 13import { VideosRoutingModule } from './videos-routing.module'
8import { VideosComponent } from './videos.component' 14import { VideosComponent } from './videos.component'
9import { VideoUserSubscriptionsComponent } from '@app/videos/video-list/video-user-subscriptions.component'
10import { VideoOverviewComponent } from '@app/videos/video-list/video-overview.component'
11 15
12@NgModule({ 16@NgModule({
13 imports: [ 17 imports: [
14 VideosRoutingModule, 18 VideosRoutingModule,
15 SharedModule 19
20 SharedMainModule,
21 SharedFormModule,
22 SharedVideoMiniatureModule,
23 SharedUserSubscriptionModule,
24 SharedGlobalIconModule
16 ], 25 ],
17 26
18 declarations: [ 27 declarations: [