diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-04-17 00:49:04 +0200 |
---|---|---|
committer | Rigel <sendmemail@rigelk.eu> | 2018-04-17 01:09:06 +0200 |
commit | 244e76a552ef05a5067134b1065d26dd89246d8c (patch) | |
tree | a15fcd52bce99797fc9366572fea62a7a44aaabe /client/src/app/videos/+video-watch | |
parent | c36d5a6b98056ef7fec3db43fbee880ee7332dcf (diff) | |
download | PeerTube-244e76a552ef05a5067134b1065d26dd89246d8c.tar.gz PeerTube-244e76a552ef05a5067134b1065d26dd89246d8c.tar.zst PeerTube-244e76a552ef05a5067134b1065d26dd89246d8c.zip |
feature: initial syndication feeds support
Provides rss 2.0, atom 1.0 and json 1.0 feeds for videos (instance and account-wide) on listings and video-watch views.
* still lacks redis caching
* still lacks lastBuildDate support
* still lacks channel-wide support
* still lacks semantic annotation (for licenses, NSFW warnings, etc.)
* still lacks love ( ˘ ³˘)
* RSS: has MRSS support for torrent lists!
* RSS: includes the first torrent in an enclosure
* JSON: lists all torrents in the 'attachments' object
* ATOM: lacking torrent listing support
Advances #23
Partial implementation for the accountId generation in the client, which will need a hotfix to add a way to get the proper account id.
Diffstat (limited to 'client/src/app/videos/+video-watch')
3 files changed, 25 insertions, 4 deletions
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index 03f64bd12..52e3e429a 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -24,6 +24,7 @@ | |||
24 | <div class="video-info-by"> | 24 | <div class="video-info-by"> |
25 | By {{ video.by }} | 25 | By {{ video.by }} |
26 | <img [src]="getAvatarPath()" alt="Account avatar" /> | 26 | <img [src]="getAvatarPath()" alt="Account avatar" /> |
27 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | ||
27 | </div> | 28 | </div> |
28 | </div> | 29 | </div> |
29 | 30 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index 03f960339..8a3e2584b 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss | |||
@@ -80,6 +80,11 @@ | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | my-video-feed { | ||
84 | margin-left: 5px; | ||
85 | margin-top: 1px; | ||
86 | } | ||
87 | |||
83 | .video-actions-rates { | 88 | .video-actions-rates { |
84 | display: flex; | 89 | display: flex; |
85 | flex-direction: column; | 90 | flex-direction: column; |
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 df5b8d02d..b3ebe3e4b 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 @@ | |||
1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild, OnChanges } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { RedirectService } from '@app/core/routing/redirect.service' | 3 | import { RedirectService } from '@app/core/routing/redirect.service' |
4 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 4 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' |
@@ -9,18 +9,20 @@ import { Subscription } from 'rxjs/Subscription' | |||
9 | import * as videojs from 'video.js' | 9 | import * as videojs from 'video.js' |
10 | import 'videojs-hotkeys' | 10 | import 'videojs-hotkeys' |
11 | import * as WebTorrent from 'webtorrent' | 11 | import * as WebTorrent from 'webtorrent' |
12 | import { UserVideoRateType, VideoRateType } from '../../../../../shared' | 12 | import { UserVideoRateType, VideoRateType, FeedFormat } from '../../../../../shared' |
13 | import '../../../assets/player/peertube-videojs-plugin' | 13 | import '../../../assets/player/peertube-videojs-plugin' |
14 | import { AuthService, ConfirmService } from '../../core' | 14 | import { AuthService, ConfirmService } from '../../core' |
15 | import { VideoBlacklistService } from '../../shared' | 15 | import { VideoBlacklistService } from '../../shared' |
16 | import { Account } from '../../shared/account/account.model' | 16 | import { Account } from '../../shared/account/account.model' |
17 | import { VideoDetails } from '../../shared/video/video-details.model' | 17 | import { VideoDetails } from '../../shared/video/video-details.model' |
18 | import { VideoFeedComponent } from '../../shared/video/video-feed.component' | ||
18 | import { Video } from '../../shared/video/video.model' | 19 | import { Video } from '../../shared/video/video.model' |
19 | import { VideoService } from '../../shared/video/video.service' | 20 | import { VideoService } from '../../shared/video/video.service' |
20 | import { MarkdownService } from '../shared' | 21 | import { MarkdownService } from '../shared' |
21 | import { VideoDownloadComponent } from './modal/video-download.component' | 22 | import { VideoDownloadComponent } from './modal/video-download.component' |
22 | import { VideoReportComponent } from './modal/video-report.component' | 23 | import { VideoReportComponent } from './modal/video-report.component' |
23 | import { VideoShareComponent } from './modal/video-share.component' | 24 | import { VideoShareComponent } from './modal/video-share.component' |
25 | import { environment } from '../../../environments/environment' | ||
24 | import { getVideojsOptions } from '../../../assets/player/peertube-player' | 26 | import { getVideojsOptions } from '../../../assets/player/peertube-player' |
25 | 27 | ||
26 | @Component({ | 28 | @Component({ |
@@ -38,6 +40,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
38 | 40 | ||
39 | otherVideosDisplayed: Video[] = [] | 41 | otherVideosDisplayed: Video[] = [] |
40 | 42 | ||
43 | syndicationItems = {} | ||
44 | |||
41 | player: videojs.Player | 45 | player: videojs.Player |
42 | playerElement: HTMLVideoElement | 46 | playerElement: HTMLVideoElement |
43 | userRating: UserVideoRateType = null | 47 | userRating: UserVideoRateType = null |
@@ -98,14 +102,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
98 | } | 102 | } |
99 | 103 | ||
100 | const uuid = routeParams['uuid'] | 104 | const uuid = routeParams['uuid'] |
101 | // Video did not changed | 105 | // Video did not change |
102 | if (this.video && this.video.uuid === uuid) return | 106 | if (this.video && this.video.uuid === uuid) return |
103 | 107 | // Video did change | |
104 | this.videoService.getVideo(uuid).subscribe( | 108 | this.videoService.getVideo(uuid).subscribe( |
105 | video => { | 109 | video => { |
106 | const startTime = this.route.snapshot.queryParams.start | 110 | const startTime = this.route.snapshot.queryParams.start |
107 | this.onVideoFetched(video, startTime) | 111 | this.onVideoFetched(video, startTime) |
108 | .catch(err => this.handleError(err)) | 112 | .catch(err => this.handleError(err)) |
113 | this.generateSyndicationList() | ||
109 | }, | 114 | }, |
110 | 115 | ||
111 | error => { | 116 | error => { |
@@ -242,6 +247,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
242 | return this.video.tags.join(', ') | 247 | return this.video.tags.join(', ') |
243 | } | 248 | } |
244 | 249 | ||
250 | generateSyndicationList () { | ||
251 | const feeds = this.videoService.getAccountFeed( | ||
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 | } | ||
259 | |||
245 | isVideoRemovable () { | 260 | isVideoRemovable () { |
246 | return this.video.isRemovableBy(this.authService.getUser()) | 261 | return this.video.isRemovableBy(this.authService.getUser()) |
247 | } | 262 | } |