import { Injectable } from '@angular/core'
import { lineFeedToHtml } from '@app/shared/misc/utils'
import { Observable } from 'rxjs'
-import { ResultList } from '../../../../../../shared/models'
+import { ResultList, FeedFormat } from '../../../../../../shared/models'
import {
VideoComment as VideoCommentServerModel,
VideoCommentCreate,
@Injectable()
export class VideoCommentService {
private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
+ private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.'
constructor (
private authHttp: HttpClient,
)
}
+ getVideoCommentsFeeds (videoUUID?: string) {
+ const feeds = [
+ {
+ format: FeedFormat.RSS,
+ label: 'rss 2.0',
+ url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
+ },
+ {
+ format: FeedFormat.ATOM,
+ label: 'atom 1.0',
+ url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
+ },
+ {
+ format: FeedFormat.JSON,
+ label: 'json 1.0',
+ url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
+ }
+ ]
+
+ if (videoUUID !== undefined) {
+ for (const feed of feeds) {
+ feed.url += '?videoId=' + videoUUID
+ }
+ }
+
+ return feeds
+ }
+
private extractVideoComment (videoComment: VideoCommentServerModel) {
return new VideoComment(videoComment)
}
<div i18n class="title-page title-page-single">
Comments
</div>
- <my-help
- *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml
- customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video."></my-help>
+
+ <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed>
</div>
<ng-template [ngIf]="video.commentsEnabled === true">
threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
threadLoading: { [ id: number ]: boolean } = {}
+ syndicationItems = []
+
private sub: Subscription
constructor (
this.componentPagination.currentPage = 1
this.componentPagination.totalItems = null
+ this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid)
+
this.loadMoreComments()
}
}