aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-11-09 16:25:27 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-25 11:07:56 +0100
commit5beb89f223539f1e415a976ff104f772526b4d20 (patch)
tree2164677d16a2965d63499e249aa75ab0e06e3a6c /client/src/app/shared
parentafff310e50f2fa8419bb4242470cbde46ab54463 (diff)
downloadPeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.gz
PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.tar.zst
PeerTube-5beb89f223539f1e415a976ff104f772526b4d20.zip
refactor scoped token service
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts2
-rw-r--r--client/src/app/shared/shared-forms/input-readonly-copy.component.ts1
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts21
3 files changed, 10 insertions, 14 deletions
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
112 getVideoEmbed (abuse: AdminAbuse) { 112 getVideoEmbed (abuse: AdminAbuse) {
113 return buildVideoOrPlaylistEmbed( 113 return buildVideoOrPlaylistEmbed(
114 buildVideoLink({ 114 buildVideoLink({
115 baseUrl: `${environment.embedUrl}/videos/embed/${abuse.video.uuid}`, 115 baseUrl: `${environment.originServerUrl}/videos/embed/${abuse.video.uuid}`,
116 title: false, 116 title: false,
117 warningTitle: false, 117 warningTitle: false,
118 startTime: abuse.video.startAt, 118 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 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier } from '@app/core'
3import { FormGroup } from '@angular/forms'
4 3
5@Component({ 4@Component({
6 selector: 'my-input-readonly-copy', 5 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 {
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) {