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 | |
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')
17 files changed, 188 insertions, 5 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 2664d59d8..b9a3bea3f 100644 --- a/client/src/app/account/account-videos/account-videos.component.ts +++ b/client/src/app/account/account-videos/account-videos.component.ts | |||
@@ -27,6 +27,8 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
27 | totalItems: null | 27 | totalItems: null |
28 | } | 28 | } |
29 | 29 | ||
30 | syndicationItems = {} | ||
31 | |||
30 | protected baseVideoWidth = -1 | 32 | protected baseVideoWidth = -1 |
31 | protected baseVideoHeight = 155 | 33 | protected baseVideoHeight = 155 |
32 | 34 | ||
@@ -61,6 +63,10 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
61 | return this.videoService.getMyVideos(newPagination, this.sort) | 63 | return this.videoService.getMyVideos(newPagination, this.sort) |
62 | } | 64 | } |
63 | 65 | ||
66 | generateSyndicationList () { | ||
67 | throw new Error('Method not implemented.') | ||
68 | } | ||
69 | |||
64 | async deleteSelectedVideos () { | 70 | async deleteSelectedVideos () { |
65 | const toDeleteVideosIds = Object.keys(this.checkedVideos) | 71 | const toDeleteVideosIds = Object.keys(this.checkedVideos) |
66 | .filter(k => this.checkedVideos[k] === true) | 72 | .filter(k => this.checkedVideos[k] === true) |
diff --git a/client/src/app/shared/misc/object-length.pipe.ts b/client/src/app/shared/misc/object-length.pipe.ts new file mode 100644 index 000000000..84d182052 --- /dev/null +++ b/client/src/app/shared/misc/object-length.pipe.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | import { Pipe, PipeTransform } from '@angular/core' | ||
2 | |||
3 | @Pipe({ name: 'myObjectLength' }) | ||
4 | export class ObjectLengthPipe implements PipeTransform { | ||
5 | transform (value: Object) { | ||
6 | return Object.keys(value).length | ||
7 | } | ||
8 | } | ||
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index eb50d45a9..74730e2aa 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -10,6 +10,7 @@ import { MarkdownService } from '@app/videos/shared' | |||
10 | 10 | ||
11 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown' | 11 | import { BsDropdownModule } from 'ngx-bootstrap/dropdown' |
12 | import { ModalModule } from 'ngx-bootstrap/modal' | 12 | import { ModalModule } from 'ngx-bootstrap/modal' |
13 | import { PopoverModule } from 'ngx-bootstrap/popover' | ||
13 | import { TabsModule } from 'ngx-bootstrap/tabs' | 14 | import { TabsModule } from 'ngx-bootstrap/tabs' |
14 | import { TooltipModule } from 'ngx-bootstrap/tooltip' | 15 | import { TooltipModule } from 'ngx-bootstrap/tooltip' |
15 | import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' | 16 | import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes' |
@@ -21,11 +22,13 @@ import { EditButtonComponent } from './misc/edit-button.component' | |||
21 | import { FromNowPipe } from './misc/from-now.pipe' | 22 | import { FromNowPipe } from './misc/from-now.pipe' |
22 | import { LoaderComponent } from './misc/loader.component' | 23 | import { LoaderComponent } from './misc/loader.component' |
23 | import { NumberFormatterPipe } from './misc/number-formatter.pipe' | 24 | import { NumberFormatterPipe } from './misc/number-formatter.pipe' |
25 | import { ObjectLengthPipe } from './misc/object-length.pipe' | ||
24 | import { RestExtractor, RestService } from './rest' | 26 | import { RestExtractor, RestService } from './rest' |
25 | import { UserService } from './users' | 27 | import { UserService } from './users' |
26 | import { VideoAbuseService } from './video-abuse' | 28 | import { VideoAbuseService } from './video-abuse' |
27 | import { VideoBlacklistService } from './video-blacklist' | 29 | import { VideoBlacklistService } from './video-blacklist' |
28 | import { VideoMiniatureComponent } from './video/video-miniature.component' | 30 | import { VideoMiniatureComponent } from './video/video-miniature.component' |
31 | import { VideoFeedComponent } from './video/video-feed.component' | ||
29 | import { VideoThumbnailComponent } from './video/video-thumbnail.component' | 32 | import { VideoThumbnailComponent } from './video/video-thumbnail.component' |
30 | import { VideoService } from './video/video.service' | 33 | import { VideoService } from './video/video.service' |
31 | 34 | ||
@@ -39,6 +42,7 @@ import { VideoService } from './video/video.service' | |||
39 | 42 | ||
40 | BsDropdownModule.forRoot(), | 43 | BsDropdownModule.forRoot(), |
41 | ModalModule.forRoot(), | 44 | ModalModule.forRoot(), |
45 | PopoverModule.forRoot(), | ||
42 | TabsModule.forRoot(), | 46 | TabsModule.forRoot(), |
43 | TooltipModule.forRoot(), | 47 | TooltipModule.forRoot(), |
44 | 48 | ||
@@ -50,9 +54,11 @@ import { VideoService } from './video/video.service' | |||
50 | LoaderComponent, | 54 | LoaderComponent, |
51 | VideoThumbnailComponent, | 55 | VideoThumbnailComponent, |
52 | VideoMiniatureComponent, | 56 | VideoMiniatureComponent, |
57 | VideoFeedComponent, | ||
53 | DeleteButtonComponent, | 58 | DeleteButtonComponent, |
54 | EditButtonComponent, | 59 | EditButtonComponent, |
55 | NumberFormatterPipe, | 60 | NumberFormatterPipe, |
61 | ObjectLengthPipe, | ||
56 | FromNowPipe, | 62 | FromNowPipe, |
57 | MarkdownTextareaComponent, | 63 | MarkdownTextareaComponent, |
58 | InfiniteScrollerDirective, | 64 | InfiniteScrollerDirective, |
@@ -68,6 +74,7 @@ import { VideoService } from './video/video.service' | |||
68 | 74 | ||
69 | BsDropdownModule, | 75 | BsDropdownModule, |
70 | ModalModule, | 76 | ModalModule, |
77 | PopoverModule, | ||
71 | TabsModule, | 78 | TabsModule, |
72 | TooltipModule, | 79 | TooltipModule, |
73 | PrimeSharedModule, | 80 | PrimeSharedModule, |
@@ -77,6 +84,7 @@ import { VideoService } from './video/video.service' | |||
77 | LoaderComponent, | 84 | LoaderComponent, |
78 | VideoThumbnailComponent, | 85 | VideoThumbnailComponent, |
79 | VideoMiniatureComponent, | 86 | VideoMiniatureComponent, |
87 | VideoFeedComponent, | ||
80 | DeleteButtonComponent, | 88 | DeleteButtonComponent, |
81 | EditButtonComponent, | 89 | EditButtonComponent, |
82 | MarkdownTextareaComponent, | 90 | MarkdownTextareaComponent, |
@@ -84,6 +92,7 @@ import { VideoService } from './video/video.service' | |||
84 | HelpComponent, | 92 | HelpComponent, |
85 | 93 | ||
86 | NumberFormatterPipe, | 94 | NumberFormatterPipe, |
95 | ObjectLengthPipe, | ||
87 | FromNowPipe | 96 | FromNowPipe |
88 | ], | 97 | ], |
89 | 98 | ||
diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/video/abstract-video-list.html index 94a38019d..cb04e07b4 100644 --- a/client/src/app/shared/video/abstract-video-list.html +++ b/client/src/app/shared/video/abstract-video-list.html | |||
@@ -2,9 +2,9 @@ | |||
2 | <div class="title-page title-page-single"> | 2 | <div class="title-page title-page-single"> |
3 | {{ titlePage }} | 3 | {{ titlePage }} |
4 | </div> | 4 | </div> |
5 | <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> | ||
5 | 6 | ||
6 | <div *ngIf="pagination.totalItems === 0">No results.</div> | 7 | <div *ngIf="pagination.totalItems === 0">No results.</div> |
7 | |||
8 | <div | 8 | <div |
9 | myInfiniteScroller | 9 | myInfiniteScroller |
10 | [pageHeight]="pageHeight" | 10 | [pageHeight]="pageHeight" |
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss index 63538a089..b75907dc9 100644 --- a/client/src/app/shared/video/abstract-video-list.scss +++ b/client/src/app/shared/video/abstract-video-list.scss | |||
@@ -1,3 +1,5 @@ | |||
1 | @import '_mixins'; | ||
2 | |||
1 | .videos { | 3 | .videos { |
2 | text-align: center; | 4 | text-align: center; |
3 | 5 | ||
@@ -6,6 +8,11 @@ | |||
6 | } | 8 | } |
7 | } | 9 | } |
8 | 10 | ||
11 | my-video-feed { | ||
12 | display: inline-block; | ||
13 | margin-left: -45px; | ||
14 | } | ||
15 | |||
9 | @media screen and (max-width: 500px) { | 16 | @media screen and (max-width: 500px) { |
10 | .videos { | 17 | .videos { |
11 | text-align: center; | 18 | text-align: center; |
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 1b9a519bd..024834dfc 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { isInMobileView } from '@app/shared/misc/utils' | 3 | import { isInMobileView } from '@app/shared/misc/utils' |
4 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' | 4 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | import { PopoverModule } from 'ngx-bootstrap/popover' | ||
6 | import 'rxjs/add/operator/debounceTime' | 7 | import 'rxjs/add/operator/debounceTime' |
7 | import { Observable } from 'rxjs/Observable' | 8 | import { Observable } from 'rxjs/Observable' |
8 | import { fromEvent } from 'rxjs/observable/fromEvent' | 9 | import { fromEvent } from 'rxjs/observable/fromEvent' |
@@ -11,6 +12,8 @@ import { AuthService } from '../../core/auth' | |||
11 | import { ComponentPagination } from '../rest/component-pagination.model' | 12 | import { ComponentPagination } from '../rest/component-pagination.model' |
12 | import { SortField } from './sort-field.type' | 13 | import { SortField } from './sort-field.type' |
13 | import { Video } from './video.model' | 14 | import { Video } from './video.model' |
15 | import { FeedFormat } from '../../../../../shared' | ||
16 | import { VideoFeedComponent } from '@app/shared/video/video-feed.component' | ||
14 | 17 | ||
15 | export abstract class AbstractVideoList implements OnInit, OnDestroy { | 18 | export abstract class AbstractVideoList implements OnInit, OnDestroy { |
16 | private static LINES_PER_PAGE = 4 | 19 | private static LINES_PER_PAGE = 4 |
@@ -25,6 +28,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
25 | } | 28 | } |
26 | sort: SortField = '-createdAt' | 29 | sort: SortField = '-createdAt' |
27 | defaultSort: SortField = '-createdAt' | 30 | defaultSort: SortField = '-createdAt' |
31 | syndicationItems = {} | ||
32 | |||
28 | loadOnInit = true | 33 | loadOnInit = true |
29 | pageHeight: number | 34 | pageHeight: number |
30 | videoWidth: number | 35 | videoWidth: number |
@@ -47,6 +52,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
47 | private resizeSubscription: Subscription | 52 | private resizeSubscription: Subscription |
48 | 53 | ||
49 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> | 54 | abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> |
55 | abstract generateSyndicationList () | ||
50 | 56 | ||
51 | get user () { | 57 | get user () { |
52 | return this.authService.getUser() | 58 | return this.authService.getUser() |
diff --git a/client/src/app/shared/video/video-feed.component.html b/client/src/app/shared/video/video-feed.component.html new file mode 100644 index 000000000..7733ef221 --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.html | |||
@@ -0,0 +1,14 @@ | |||
1 | <div class="video-feed"> | ||
2 | <span *ngIf="(syndicationItems | myObjectLength) >= 1" class="icon icon-syndication" | ||
3 | [popover]="feedsList" | ||
4 | placement="bottom" | ||
5 | [outsideClick]="true"> | ||
6 | </span> | ||
7 | |||
8 | <ng-template #feedsList> | ||
9 | <div *ngFor="let key of syndicationItems | keys"> | ||
10 | <a [href]="syndicationItems[key]">{{ key }}</a> | ||
11 | </div> | ||
12 | </ng-template> | ||
13 | </div> | ||
14 | \ No newline at end of file | ||
diff --git a/client/src/app/shared/video/video-feed.component.scss b/client/src/app/shared/video/video-feed.component.scss new file mode 100644 index 000000000..2efeb405e --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.scss | |||
@@ -0,0 +1,19 @@ | |||
1 | @import '_mixins'; | ||
2 | |||
3 | .video-feed { | ||
4 | a { | ||
5 | @include disable-default-a-behaviour; | ||
6 | |||
7 | color: black; | ||
8 | } | ||
9 | |||
10 | .icon { | ||
11 | @include icon(12px); | ||
12 | |||
13 | &.icon-syndication { | ||
14 | position: relative; | ||
15 | top: -2px; | ||
16 | background-image: url('../../../assets/images/global/syndication.svg'); | ||
17 | } | ||
18 | } | ||
19 | } \ 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 new file mode 100644 index 000000000..41257ca99 --- /dev/null +++ b/client/src/app/shared/video/video-feed.component.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' | ||
2 | |||
3 | @Component({ | ||
4 | selector: 'my-video-feed', | ||
5 | styleUrls: [ './video-feed.component.scss' ], | ||
6 | templateUrl: './video-feed.component.html' | ||
7 | }) | ||
8 | export class VideoFeedComponent implements OnChanges { | ||
9 | @Input() syndicationItems | ||
10 | |||
11 | ngOnChanges (changes: SimpleChanges) { | ||
12 | this.syndicationItems = changes.syndicationItems.currentValue | ||
13 | } | ||
14 | } | ||
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 0a8894fd9..009155410 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -8,6 +8,7 @@ import { ResultList } from '../../../../../shared/models/result-list.model' | |||
8 | import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model' | 8 | import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model' |
9 | import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model' | 9 | import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model' |
10 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' | 10 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' |
11 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
11 | import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' | 12 | import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' |
12 | import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' | 13 | import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' |
13 | import { environment } from '../../../environments/environment' | 14 | import { environment } from '../../../environments/environment' |
@@ -24,6 +25,7 @@ import { objectToFormData } from '@app/shared/misc/utils' | |||
24 | @Injectable() | 25 | @Injectable() |
25 | export class VideoService { | 26 | export class VideoService { |
26 | private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' | 27 | private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' |
28 | private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' | ||
27 | 29 | ||
28 | constructor ( | 30 | constructor ( |
29 | private authHttp: HttpClient, | 31 | private authHttp: HttpClient, |
@@ -115,6 +117,47 @@ export class VideoService { | |||
115 | .catch((res) => this.restExtractor.handleError(res)) | 117 | .catch((res) => this.restExtractor.handleError(res)) |
116 | } | 118 | } |
117 | 119 | ||
120 | baseFeed () { | ||
121 | const feed = {} | ||
122 | |||
123 | for (let item in FeedFormat) { | ||
124 | feed[FeedFormat[item]] = VideoService.BASE_FEEDS_URL + item.toLowerCase() | ||
125 | } | ||
126 | |||
127 | return feed | ||
128 | } | ||
129 | |||
130 | getFeed ( | ||
131 | filter?: VideoFilter | ||
132 | ) { | ||
133 | let params = this.restService.addRestGetParams(new HttpParams()) | ||
134 | const feed = this.baseFeed() | ||
135 | |||
136 | if (filter) { | ||
137 | params = params.set('filter', filter) | ||
138 | } | ||
139 | for (let item in feed) { | ||
140 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | ||
141 | } | ||
142 | |||
143 | return feed | ||
144 | } | ||
145 | |||
146 | getAccountFeed ( | ||
147 | accountId: number, | ||
148 | host?: string | ||
149 | ) { | ||
150 | let params = this.restService.addRestGetParams(new HttpParams()) | ||
151 | const feed = this.baseFeed() | ||
152 | |||
153 | params = params.set('accountId', accountId.toString()) | ||
154 | for (let item in feed) { | ||
155 | feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() | ||
156 | } | ||
157 | |||
158 | return feed | ||
159 | } | ||
160 | |||
118 | searchVideos ( | 161 | searchVideos ( |
119 | search: string, | 162 | search: string, |
120 | videoPagination: ComponentPagination, | 163 | videoPagination: ComponentPagination, |
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 | } |
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 8f9d50a7b..9d626abd1 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -3,9 +3,12 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
6 | import { PopoverModule } from 'ngx-bootstrap/popover' | ||
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7 | import { SortField } from '../../shared/video/sort-field.type' | 8 | import { SortField } from '../../shared/video/sort-field.type' |
8 | import { VideoService } from '../../shared/video/video.service' | 9 | import { VideoService } from '../../shared/video/video.service' |
10 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
11 | import * as url from 'url' | ||
9 | 12 | ||
10 | @Component({ | 13 | @Component({ |
11 | selector: 'my-videos-local', | 14 | selector: 'my-videos-local', |
@@ -27,6 +30,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
27 | 30 | ||
28 | ngOnInit () { | 31 | ngOnInit () { |
29 | super.ngOnInit() | 32 | super.ngOnInit() |
33 | this.generateSyndicationList() | ||
30 | } | 34 | } |
31 | 35 | ||
32 | ngOnDestroy () { | 36 | ngOnDestroy () { |
@@ -38,4 +42,11 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
38 | 42 | ||
39 | return this.videoService.getVideos(newPagination, this.sort, 'local') | 43 | return this.videoService.getVideos(newPagination, this.sort, 'local') |
40 | } | 44 | } |
45 | |||
46 | generateSyndicationList () { | ||
47 | const feeds = this.videoService.getFeed('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 | } | ||
41 | } | 52 | } |
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 1cecd14a0..2bdc20d92 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 | |||
@@ -6,6 +6,8 @@ import { AuthService } from '../../core/auth' | |||
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7 | import { SortField } from '../../shared/video/sort-field.type' | 7 | import { SortField } from '../../shared/video/sort-field.type' |
8 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
9 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
10 | import * as url from 'url' | ||
9 | 11 | ||
10 | @Component({ | 12 | @Component({ |
11 | selector: 'my-videos-recently-added', | 13 | selector: 'my-videos-recently-added', |
@@ -27,6 +29,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
27 | 29 | ||
28 | ngOnInit () { | 30 | ngOnInit () { |
29 | super.ngOnInit() | 31 | super.ngOnInit() |
32 | this.generateSyndicationList() | ||
30 | } | 33 | } |
31 | 34 | ||
32 | ngOnDestroy () { | 35 | ngOnDestroy () { |
@@ -38,4 +41,11 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
38 | 41 | ||
39 | return this.videoService.getVideos(newPagination, this.sort) | 42 | return this.videoService.getVideos(newPagination, this.sort) |
40 | } | 43 | } |
44 | |||
45 | generateSyndicationList () { | ||
46 | const feeds = this.videoService.getFeed('local') | ||
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 | } | ||
41 | } | 51 | } |
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts index b94be8e11..ef9afa757 100644 --- a/client/src/app/videos/video-list/video-search.component.ts +++ b/client/src/app/videos/video-list/video-search.component.ts | |||
@@ -7,6 +7,7 @@ import { Subscription } from 'rxjs/Subscription' | |||
7 | import { AuthService } from '../../core/auth' | 7 | import { AuthService } from '../../core/auth' |
8 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 8 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
9 | import { VideoService } from '../../shared/video/video.service' | 9 | import { VideoService } from '../../shared/video/video.service' |
10 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
10 | 11 | ||
11 | @Component({ | 12 | @Component({ |
12 | selector: 'my-videos-search', | 13 | selector: 'my-videos-search', |
@@ -61,4 +62,8 @@ export class VideoSearchComponent extends AbstractVideoList implements OnInit, O | |||
61 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 62 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
62 | return this.videoService.searchVideos(this.otherRouteParams.search, newPagination, this.sort) | 63 | return this.videoService.searchVideos(this.otherRouteParams.search, newPagination, this.sort) |
63 | } | 64 | } |
65 | |||
66 | generateSyndicationList () { | ||
67 | throw new Error('Method not implemented.') | ||
68 | } | ||
64 | } | 69 | } |
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 1dd1ad23b..905c75ab0 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -6,6 +6,8 @@ import { AuthService } from '../../core/auth' | |||
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7 | import { SortField } from '../../shared/video/sort-field.type' | 7 | import { SortField } from '../../shared/video/sort-field.type' |
8 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
9 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
10 | import * as url from 'url' | ||
9 | 11 | ||
10 | @Component({ | 12 | @Component({ |
11 | selector: 'my-videos-trending', | 13 | selector: 'my-videos-trending', |
@@ -27,6 +29,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
27 | 29 | ||
28 | ngOnInit () { | 30 | ngOnInit () { |
29 | super.ngOnInit() | 31 | super.ngOnInit() |
32 | this.generateSyndicationList() | ||
30 | } | 33 | } |
31 | 34 | ||
32 | ngOnDestroy () { | 35 | ngOnDestroy () { |
@@ -37,4 +40,11 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
37 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 40 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
38 | return this.videoService.getVideos(newPagination, this.sort) | 41 | return this.videoService.getVideos(newPagination, this.sort) |
39 | } | 42 | } |
43 | |||
44 | generateSyndicationList () { | ||
45 | const feeds = this.videoService.getFeed('local') | ||
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 | } | ||
40 | } | 50 | } |