]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.service.ts
allow private syndication feeds via a user feedToken
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.service.ts
index c8a3ec043a7c9f3bef5da72b2a9f0b3be71fa39e..b81540e8ddeabd1cb1356fadcbc2fd90941b0bd1 100644 (file)
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs'
 import { catchError, map, switchMap } from 'rxjs/operators'
 import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'
 import { Injectable } from '@angular/core'
-import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService } from '@app/core'
+import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService, AuthService } from '@app/core'
 import { objectToFormData } from '@app/helpers'
 import {
   FeedFormat,
@@ -49,7 +49,8 @@ export class VideoService implements VideosProvider {
     private authHttp: HttpClient,
     private restExtractor: RestExtractor,
     private restService: RestService,
-    private serverService: ServerService
+    private serverService: ServerService,
+    private authService: AuthService
   ) {}
 
   getVideoViewUrl (uuid: string) {
@@ -293,6 +294,16 @@ export class VideoService implements VideosProvider {
     return this.buildBaseFeedUrls(params)
   }
 
+  async getVideoSubscriptionFeedUrls (accountId: number) {
+    let params = this.restService.addRestGetParams(new HttpParams())
+    params = params.set('accountId', accountId.toString())
+
+    const { feedToken } = await this.authService.getScopedTokens()
+    params = params.set('token', feedToken)
+
+    return this.buildBaseFeedUrls(params)
+  }
+
   getVideoFileMetadata (metadataUrl: string) {
     return this.authHttp
                .get<VideoFileMetadata>(metadataUrl)