From 5beb89f223539f1e415a976ff104f772526b4d20 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 9 Nov 2020 16:25:27 +0100 Subject: refactor scoped token service --- .../shared-abuse-list/abuse-list-table.component.ts | 2 +- .../shared-forms/input-readonly-copy.component.ts | 1 - .../app/shared/shared-main/video/video.service.ts | 21 +++++++++------------ 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index ca0d23699..807665b9c 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts @@ -112,7 +112,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV getVideoEmbed (abuse: AdminAbuse) { return buildVideoOrPlaylistEmbed( buildVideoLink({ - baseUrl: `${environment.embedUrl}/videos/embed/${abuse.video.uuid}`, + baseUrl: `${environment.originServerUrl}/videos/embed/${abuse.video.uuid}`, title: false, warningTitle: false, startTime: abuse.video.startAt, diff --git a/client/src/app/shared/shared-forms/input-readonly-copy.component.ts b/client/src/app/shared/shared-forms/input-readonly-copy.component.ts index 520827a53..b04d69d05 100644 --- a/client/src/app/shared/shared-forms/input-readonly-copy.component.ts +++ b/client/src/app/shared/shared-forms/input-readonly-copy.component.ts @@ -1,6 +1,5 @@ import { Component, Input } from '@angular/core' import { Notifier } from '@app/core' -import { FormGroup } from '@angular/forms' @Component({ selector: 'my-input-readonly-copy', 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 { VideoFilter, VideoPrivacy, VideoSortField, - VideoUpdate, - VideoCreate + VideoUpdate } from '@shared/models' import { environment } from '../../../../environments/environment' import { Account } from '../account/account.model' @@ -44,13 +43,13 @@ export interface VideosProvider { export class VideoService implements VideosProvider { static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' + static BASE_SUBSCRIPTION_FEEDS_URL = environment.apiUrl + '/feeds/subscriptions.' constructor ( private authHttp: HttpClient, private restExtractor: RestExtractor, private restService: RestService, - private serverService: ServerService, - private authService: AuthService + private serverService: ServerService ) {} getVideoViewUrl (uuid: string) { @@ -238,22 +237,22 @@ export class VideoService implements VideosProvider { ) } - buildBaseFeedUrls (params: HttpParams) { + buildBaseFeedUrls (params: HttpParams, base = VideoService.BASE_FEEDS_URL) { const feeds = [ { format: FeedFormat.RSS, label: 'media rss 2.0', - url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase() + url: base + FeedFormat.RSS.toLowerCase() }, { format: FeedFormat.ATOM, label: 'atom 1.0', - url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase() + url: base + FeedFormat.ATOM.toLowerCase() }, { format: FeedFormat.JSON, label: 'json 1.0', - url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase() + url: base + FeedFormat.JSON.toLowerCase() } ] @@ -294,14 +293,12 @@ export class VideoService implements VideosProvider { return this.buildBaseFeedUrls(params) } - async getVideoSubscriptionFeedUrls (accountId: number) { + getVideoSubscriptionFeedUrls (accountId: number, feedToken: string) { 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) + return this.buildBaseFeedUrls(params, VideoService.BASE_SUBSCRIPTION_FEEDS_URL) } getVideoFileMetadata (metadataUrl: string) { -- cgit v1.2.3