aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts21
1 files changed, 9 insertions, 12 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index b81540e8d..70be5d7d2 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -18,8 +18,7 @@ import {
18 VideoFilter, 18 VideoFilter,
19 VideoPrivacy, 19 VideoPrivacy,
20 VideoSortField, 20 VideoSortField,
21 VideoUpdate, 21 VideoUpdate
22 VideoCreate
23} from '@shared/models' 22} from '@shared/models'
24import { environment } from '../../../../environments/environment' 23import { environment } from '../../../../environments/environment'
25import { Account } from '../account/account.model' 24import { Account } from '../account/account.model'
@@ -44,13 +43,13 @@ export interface VideosProvider {
44export class VideoService implements VideosProvider { 43export class VideoService implements VideosProvider {
45 static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' 44 static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
46 static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' 45 static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.'
46 static BASE_SUBSCRIPTION_FEEDS_URL = environment.apiUrl + '/feeds/subscriptions.'
47 47
48 constructor ( 48 constructor (
49 private authHttp: HttpClient, 49 private authHttp: HttpClient,
50 private restExtractor: RestExtractor, 50 private restExtractor: RestExtractor,
51 private restService: RestService, 51 private restService: RestService,
52 private serverService: ServerService, 52 private serverService: ServerService
53 private authService: AuthService
54 ) {} 53 ) {}
55 54
56 getVideoViewUrl (uuid: string) { 55 getVideoViewUrl (uuid: string) {
@@ -238,22 +237,22 @@ export class VideoService implements VideosProvider {
238 ) 237 )
239 } 238 }
240 239
241 buildBaseFeedUrls (params: HttpParams) { 240 buildBaseFeedUrls (params: HttpParams, base = VideoService.BASE_FEEDS_URL) {
242 const feeds = [ 241 const feeds = [
243 { 242 {
244 format: FeedFormat.RSS, 243 format: FeedFormat.RSS,
245 label: 'media rss 2.0', 244 label: 'media rss 2.0',
246 url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase() 245 url: base + FeedFormat.RSS.toLowerCase()
247 }, 246 },
248 { 247 {
249 format: FeedFormat.ATOM, 248 format: FeedFormat.ATOM,
250 label: 'atom 1.0', 249 label: 'atom 1.0',
251 url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase() 250 url: base + FeedFormat.ATOM.toLowerCase()
252 }, 251 },
253 { 252 {
254 format: FeedFormat.JSON, 253 format: FeedFormat.JSON,
255 label: 'json 1.0', 254 label: 'json 1.0',
256 url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase() 255 url: base + FeedFormat.JSON.toLowerCase()
257 } 256 }
258 ] 257 ]
259 258
@@ -294,14 +293,12 @@ export class VideoService implements VideosProvider {
294 return this.buildBaseFeedUrls(params) 293 return this.buildBaseFeedUrls(params)
295 } 294 }
296 295
297 async getVideoSubscriptionFeedUrls (accountId: number) { 296 getVideoSubscriptionFeedUrls (accountId: number, feedToken: string) {
298 let params = this.restService.addRestGetParams(new HttpParams()) 297 let params = this.restService.addRestGetParams(new HttpParams())
299 params = params.set('accountId', accountId.toString()) 298 params = params.set('accountId', accountId.toString())
300
301 const { feedToken } = await this.authService.getScopedTokens()
302 params = params.set('token', feedToken) 299 params = params.set('token', feedToken)
303 300
304 return this.buildBaseFeedUrls(params) 301 return this.buildBaseFeedUrls(params, VideoService.BASE_SUBSCRIPTION_FEEDS_URL)
305 } 302 }
306 303
307 getVideoFileMetadata (metadataUrl: string) { 304 getVideoFileMetadata (metadataUrl: string) {