aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/account/account-videos/account-videos.component.ts4
-rw-r--r--client/src/app/shared/video/abstract-video-list.scss5
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts5
-rw-r--r--client/src/app/shared/video/video-feed.component.html9
-rw-r--r--client/src/app/shared/video/video-feed.component.ts8
-rw-r--r--client/src/app/shared/video/video.service.ts64
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts14
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts6
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts6
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts8
10 files changed, 58 insertions, 71 deletions
diff --git a/client/src/app/account/account-videos/account-videos.component.ts b/client/src/app/account/account-videos/account-videos.component.ts
index b9a3bea3f..07f5b7f0b 100644
--- a/client/src/app/account/account-videos/account-videos.component.ts
+++ b/client/src/app/account/account-videos/account-videos.component.ts
@@ -27,8 +27,6 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
27 totalItems: null 27 totalItems: null
28 } 28 }
29 29
30 syndicationItems = {}
31
32 protected baseVideoWidth = -1 30 protected baseVideoWidth = -1
33 protected baseVideoHeight = 155 31 protected baseVideoHeight = 155
34 32
@@ -43,6 +41,8 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
43 41
44 ngOnInit () { 42 ngOnInit () {
45 super.ngOnInit() 43 super.ngOnInit()
44
45 // this.generateSyndicationList()
46 } 46 }
47 47
48 ngOnDestroy () { 48 ngOnDestroy () {
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss
index b75907dc9..913fcfe22 100644
--- a/client/src/app/shared/video/abstract-video-list.scss
+++ b/client/src/app/shared/video/abstract-video-list.scss
@@ -8,9 +8,12 @@
8 } 8 }
9} 9}
10 10
11.title-page.title-page-single {
12 margin-right: 5px;
13}
14
11my-video-feed { 15my-video-feed {
12 display: inline-block; 16 display: inline-block;
13 margin-left: -45px;
14} 17}
15 18
16@media screen and (max-width: 500px) { 19@media screen and (max-width: 500px) {
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 024834dfc..c1c07e628 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from '@angular/router'
3import { isInMobileView } from '@app/shared/misc/utils' 3import { isInMobileView } from '@app/shared/misc/utils'
4import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' 4import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive'
5import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
6import { PopoverModule } from 'ngx-bootstrap/popover'
7import 'rxjs/add/operator/debounceTime' 6import 'rxjs/add/operator/debounceTime'
8import { Observable } from 'rxjs/Observable' 7import { Observable } from 'rxjs/Observable'
9import { fromEvent } from 'rxjs/observable/fromEvent' 8import { fromEvent } from 'rxjs/observable/fromEvent'
@@ -12,8 +11,6 @@ import { AuthService } from '../../core/auth'
12import { ComponentPagination } from '../rest/component-pagination.model' 11import { ComponentPagination } from '../rest/component-pagination.model'
13import { SortField } from './sort-field.type' 12import { SortField } from './sort-field.type'
14import { Video } from './video.model' 13import { Video } from './video.model'
15import { FeedFormat } from '../../../../../shared'
16import { VideoFeedComponent } from '@app/shared/video/video-feed.component'
17 14
18export abstract class AbstractVideoList implements OnInit, OnDestroy { 15export abstract class AbstractVideoList implements OnInit, OnDestroy {
19 private static LINES_PER_PAGE = 4 16 private static LINES_PER_PAGE = 4
@@ -28,7 +25,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
28 } 25 }
29 sort: SortField = '-createdAt' 26 sort: SortField = '-createdAt'
30 defaultSort: SortField = '-createdAt' 27 defaultSort: SortField = '-createdAt'
31 syndicationItems = {} 28 syndicationItems = []
32 29
33 loadOnInit = true 30 loadOnInit = true
34 pageHeight: number 31 pageHeight: number
diff --git a/client/src/app/shared/video/video-feed.component.html b/client/src/app/shared/video/video-feed.component.html
index 7733ef221..5ef13e1ed 100644
--- a/client/src/app/shared/video/video-feed.component.html
+++ b/client/src/app/shared/video/video-feed.component.html
@@ -1,14 +1,13 @@
1<div class="video-feed"> 1<div class="video-feed">
2 <span *ngIf="(syndicationItems | myObjectLength) >= 1" class="icon icon-syndication" 2 <span *ngIf="syndicationItems.length !== 0" class="icon icon-syndication"
3 [popover]="feedsList" 3 [popover]="feedsList"
4 placement="bottom" 4 placement="bottom"
5 [outsideClick]="true"> 5 [outsideClick]="true">
6 </span> 6 </span>
7 7
8 <ng-template #feedsList> 8 <ng-template #feedsList>
9 <div *ngFor="let key of syndicationItems | keys"> 9 <div *ngFor="let item of syndicationItems">
10 <a [href]="syndicationItems[key]">{{ key }}</a> 10 <a [href]="item.url" target="_blank" rel="noopener noreferrer">{{ item.label }}</a>
11 </div> 11 </div>
12 </ng-template> 12 </ng-template>
13</div> 13</div> \ No newline at end of file
14 \ No newline at end of file
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts
index 41257ca99..6922153c0 100644
--- a/client/src/app/shared/video/video-feed.component.ts
+++ b/client/src/app/shared/video/video-feed.component.ts
@@ -1,14 +1,10 @@
1import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' 1import { Component, Input } from '@angular/core'
2 2
3@Component({ 3@Component({
4 selector: 'my-video-feed', 4 selector: 'my-video-feed',
5 styleUrls: [ './video-feed.component.scss' ], 5 styleUrls: [ './video-feed.component.scss' ],
6 templateUrl: './video-feed.component.html' 6 templateUrl: './video-feed.component.html'
7}) 7})
8export class VideoFeedComponent implements OnChanges { 8export class VideoFeedComponent {
9 @Input() syndicationItems 9 @Input() syndicationItems
10
11 ngOnChanges (changes: SimpleChanges) {
12 this.syndicationItems = changes.syndicationItems.currentValue
13 }
14} 10}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 009155410..4c19c3765 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -117,45 +117,53 @@ export class VideoService {
117 .catch((res) => this.restExtractor.handleError(res)) 117 .catch((res) => this.restExtractor.handleError(res))
118 } 118 }
119 119
120 baseFeed () { 120 buildBaseFeedUrls () {
121 const feed = {} 121 const feeds = [
122 122 {
123 for (let item in FeedFormat) { 123 label: 'rss 2.0',
124 feed[FeedFormat[item]] = VideoService.BASE_FEEDS_URL + item.toLowerCase() 124 url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
125 } 125 },
126 126 {
127 return feed 127 label: 'atom 1.0',
128 } 128 url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
129 129 },
130 getFeed ( 130 {
131 filter?: VideoFilter 131 label: 'json 1.0',
132 ) { 132 url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
133 }
134 ]
135
136 return feeds
137 }
138
139 getVideoFeedUrls (filter?: VideoFilter) {
133 let params = this.restService.addRestGetParams(new HttpParams()) 140 let params = this.restService.addRestGetParams(new HttpParams())
134 const feed = this.baseFeed() 141 const feeds = this.buildBaseFeedUrls()
135 142
136 if (filter) { 143 if (filter) params = params.set('filter', filter)
137 params = params.set('filter', filter) 144
138 } 145 if (params.keys().length !== 0) {
139 for (let item in feed) { 146 for (let item of feeds) {
140 feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() 147 item.url += `?${params.toString()}`
148 }
141 } 149 }
142 150
143 return feed 151 return feeds
144 } 152 }
145 153
146 getAccountFeed ( 154 getAccountFeedUrls (accountId: number) {
147 accountId: number,
148 host?: string
149 ) {
150 let params = this.restService.addRestGetParams(new HttpParams()) 155 let params = this.restService.addRestGetParams(new HttpParams())
151 const feed = this.baseFeed() 156 const feeds = this.buildBaseFeedUrls()
152 157
153 params = params.set('accountId', accountId.toString()) 158 params = params.set('accountId', accountId.toString())
154 for (let item in feed) { 159
155 feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() 160 if (params.keys().length !== 0) {
161 for (let item of feeds) {
162 item.url += `?${params.toString()}`
163 }
156 } 164 }
157 165
158 return feed 166 return feeds
159 } 167 }
160 168
161 searchVideos ( 169 searchVideos (
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 b3ebe3e4b..182703cdf 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -1,4 +1,4 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild, OnChanges } from '@angular/core' 1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { RedirectService } from '@app/core/routing/redirect.service' 3import { RedirectService } from '@app/core/routing/redirect.service'
4import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' 4import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
@@ -9,20 +9,18 @@ import { Subscription } from 'rxjs/Subscription'
9import * as videojs from 'video.js' 9import * as videojs from 'video.js'
10import 'videojs-hotkeys' 10import 'videojs-hotkeys'
11import * as WebTorrent from 'webtorrent' 11import * as WebTorrent from 'webtorrent'
12import { UserVideoRateType, VideoRateType, FeedFormat } from '../../../../../shared' 12import { UserVideoRateType, VideoRateType } from '../../../../../shared'
13import '../../../assets/player/peertube-videojs-plugin' 13import '../../../assets/player/peertube-videojs-plugin'
14import { AuthService, ConfirmService } from '../../core' 14import { AuthService, ConfirmService } from '../../core'
15import { VideoBlacklistService } from '../../shared' 15import { VideoBlacklistService } from '../../shared'
16import { Account } from '../../shared/account/account.model' 16import { Account } from '../../shared/account/account.model'
17import { VideoDetails } from '../../shared/video/video-details.model' 17import { VideoDetails } from '../../shared/video/video-details.model'
18import { VideoFeedComponent } from '../../shared/video/video-feed.component'
19import { Video } from '../../shared/video/video.model' 18import { Video } from '../../shared/video/video.model'
20import { VideoService } from '../../shared/video/video.service' 19import { VideoService } from '../../shared/video/video.service'
21import { MarkdownService } from '../shared' 20import { MarkdownService } from '../shared'
22import { VideoDownloadComponent } from './modal/video-download.component' 21import { VideoDownloadComponent } from './modal/video-download.component'
23import { VideoReportComponent } from './modal/video-report.component' 22import { VideoReportComponent } from './modal/video-report.component'
24import { VideoShareComponent } from './modal/video-share.component' 23import { VideoShareComponent } from './modal/video-share.component'
25import { environment } from '../../../environments/environment'
26import { getVideojsOptions } from '../../../assets/player/peertube-player' 24import { getVideojsOptions } from '../../../assets/player/peertube-player'
27 25
28@Component({ 26@Component({
@@ -248,13 +246,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
248 } 246 }
249 247
250 generateSyndicationList () { 248 generateSyndicationList () {
251 const feeds = this.videoService.getAccountFeed( 249 this.syndicationItems = this.videoService.getAccountFeedUrls(this.video.account.id)
252 this.video.account.id,
253 (this.video.isLocal) ? environment.apiUrl : this.video.account.host
254 )
255 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
256 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
257 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
258 } 250 }
259 251
260 isVideoRemovable () { 252 isVideoRemovable () {
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 9d626abd1..90eb96afe 100644
--- a/client/src/app/videos/video-list/video-local.component.ts
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -30,6 +30,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
30 30
31 ngOnInit () { 31 ngOnInit () {
32 super.ngOnInit() 32 super.ngOnInit()
33
33 this.generateSyndicationList() 34 this.generateSyndicationList()
34 } 35 }
35 36
@@ -44,9 +45,6 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
44 } 45 }
45 46
46 generateSyndicationList () { 47 generateSyndicationList () {
47 const feeds = this.videoService.getFeed('local') 48 this.syndicationItems = this.videoService.getVideoFeedUrls('local')
48 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
49 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
50 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
51 } 49 }
52} 50}
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 2bdc20d92..3b8108b00 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
@@ -29,6 +29,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
29 29
30 ngOnInit () { 30 ngOnInit () {
31 super.ngOnInit() 31 super.ngOnInit()
32
32 this.generateSyndicationList() 33 this.generateSyndicationList()
33 } 34 }
34 35
@@ -43,9 +44,6 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
43 } 44 }
44 45
45 generateSyndicationList () { 46 generateSyndicationList () {
46 const feeds = this.videoService.getFeed('local') 47 this.syndicationItems = this.videoService.getVideoFeedUrls()
47 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
48 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
49 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
50 } 48 }
51} 49}
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 905c75ab0..6358ef91f 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -6,8 +6,6 @@ import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { SortField } from '../../shared/video/sort-field.type' 7import { SortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service' 8import { VideoService } from '../../shared/video/video.service'
9import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
10import * as url from 'url'
11 9
12@Component({ 10@Component({
13 selector: 'my-videos-trending', 11 selector: 'my-videos-trending',
@@ -29,6 +27,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
29 27
30 ngOnInit () { 28 ngOnInit () {
31 super.ngOnInit() 29 super.ngOnInit()
30
32 this.generateSyndicationList() 31 this.generateSyndicationList()
33 } 32 }
34 33
@@ -42,9 +41,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
42 } 41 }
43 42
44 generateSyndicationList () { 43 generateSyndicationList () {
45 const feeds = this.videoService.getFeed('local') 44 this.syndicationItems = this.videoService.getVideoFeedUrls()
46 this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS]
47 this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM]
48 this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON]
49 } 45 }
50} 46}