]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+videos/video-list/video-local.component.ts
Fix rss feed with HLS videos
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / video-list / video-local.component.ts
CommitLineData
9af61e84 1import { Component, OnDestroy, OnInit } from '@angular/core'
066e94c5 2import { ActivatedRoute, Router } from '@angular/router'
67ed6552 3import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
93cae479 4import { HooksService } from '@app/core/plugins/hooks.service'
67ed6552
C
5import { immutableAssign } from '@app/helpers'
6import { VideoService } from '@app/shared/shared-main'
7import { AbstractVideoList } from '@app/shared/shared-video-miniature'
67ed6552 8import { UserRight, VideoFilter, VideoSortField } from '@shared/models'
066e94c5
C
9
10@Component({
11 selector: 'my-videos-local',
67ed6552
C
12 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
13 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
066e94c5 14})
9af61e84 15export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 16 titlePage: string
136cce4d 17 sort = '-publishedAt' as VideoSortField
7b87d2d5 18 filter: VideoFilter = 'local'
066e94c5 19
5c20a455 20 useUserVideoPreferences = true
3caf77d3 21
989e526a
C
22 constructor (
23 protected router: Router,
489290b8 24 protected serverService: ServerService,
989e526a 25 protected route: ActivatedRoute,
f8b2c1b4 26 protected notifier: Notifier,
989e526a 27 protected authService: AuthService,
d3217560 28 protected userService: UserService,
bbe0f064 29 protected screenService: ScreenService,
d3217560 30 protected storageService: LocalStorageService,
93cae479
C
31 private videoService: VideoService,
32 private hooks: HooksService
989e526a 33 ) {
066e94c5 34 super()
989e526a 35
66357162 36 this.titlePage = $localize`Local videos`
066e94c5
C
37 }
38
39 ngOnInit () {
40 super.ngOnInit()
cc1561f9 41
0aa52e17 42 this.enableAllFilterIfPossible()
244e76a5 43 this.generateSyndicationList()
066e94c5
C
44 }
45
9af61e84
C
46 ngOnDestroy () {
47 super.ngOnDestroy()
48 }
49
066e94c5
C
50 getVideosObservable (page: number) {
51 const newPagination = immutableAssign(this.pagination, { currentPage: page })
93cae479 52 const params = {
3caf77d3
C
53 videoPagination: newPagination,
54 sort: this.sort,
55 filter: this.filter,
56 categoryOneOf: this.categoryOneOf,
440d39c5 57 languageOneOf: this.languageOneOf,
5c20a455 58 nsfwPolicy: this.nsfwPolicy,
440d39c5 59 skipCount: true
93cae479
C
60 }
61
62 return this.hooks.wrapObsFun(
63 this.videoService.getVideos.bind(this.videoService),
64 params,
65 'common',
7663e55a
C
66 'filter:api.local-videos.videos.list.params',
67 'filter:api.local-videos.videos.list.result'
93cae479 68 )
066e94c5 69 }
244e76a5
RK
70
71 generateSyndicationList () {
d59cba29 72 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter, this.categoryOneOf)
244e76a5 73 }
017c3dca
C
74
75 toggleModerationDisplay () {
0aa52e17 76 this.filter = this.buildLocalFilter(this.filter, 'local')
017c3dca
C
77
78 this.reloadVideos()
79 }
066e94c5 80}