diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-08-13 15:07:23 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 11:07:56 +0100 |
commit | afff310e50f2fa8419bb4242470cbde46ab54463 (patch) | |
tree | 34efda2daf8f7cdfd89ef6616a79e2222082f93a /client/src/app/shared | |
parent | f619de0e435f7ac3abad2ec772397486358b56e7 (diff) | |
download | PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.tar.gz PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.tar.zst PeerTube-afff310e50f2fa8419bb4242470cbde46ab54463.zip |
allow private syndication feeds via a user feedToken
Diffstat (limited to 'client/src/app/shared')
4 files changed, 38 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-icons/global-icon.component.ts b/client/src/app/shared/shared-icons/global-icon.component.ts index f3c1fe59b..53a2aee9a 100644 --- a/client/src/app/shared/shared-icons/global-icon.component.ts +++ b/client/src/app/shared/shared-icons/global-icon.component.ts | |||
@@ -69,7 +69,8 @@ const icons = { | |||
69 | 'columns': require('!!raw-loader?!../../../assets/images/feather/columns.svg').default, | 69 | 'columns': require('!!raw-loader?!../../../assets/images/feather/columns.svg').default, |
70 | 'live': require('!!raw-loader?!../../../assets/images/feather/live.svg').default, | 70 | 'live': require('!!raw-loader?!../../../assets/images/feather/live.svg').default, |
71 | 'repeat': require('!!raw-loader?!../../../assets/images/feather/repeat.svg').default, | 71 | 'repeat': require('!!raw-loader?!../../../assets/images/feather/repeat.svg').default, |
72 | 'message-circle': require('!!raw-loader?!../../../assets/images/feather/message-circle.svg').default | 72 | 'message-circle': require('!!raw-loader?!../../../assets/images/feather/message-circle.svg').default, |
73 | 'codesandbox': require('!!raw-loader?!../../../assets/images/feather/codesandbox.svg').default | ||
73 | } | 74 | } |
74 | 75 | ||
75 | export type GlobalIconName = keyof typeof icons | 76 | export type GlobalIconName = keyof typeof icons |
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 c8a3ec043..b81540e8d 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs' | |||
2 | import { catchError, map, switchMap } from 'rxjs/operators' | 2 | import { catchError, map, switchMap } from 'rxjs/operators' |
3 | import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' | 3 | import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService } from '@app/core' | 5 | import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService, AuthService } from '@app/core' |
6 | import { objectToFormData } from '@app/helpers' | 6 | import { objectToFormData } from '@app/helpers' |
7 | import { | 7 | import { |
8 | FeedFormat, | 8 | FeedFormat, |
@@ -49,7 +49,8 @@ export class VideoService implements VideosProvider { | |||
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 | ||
53 | ) {} | 54 | ) {} |
54 | 55 | ||
55 | getVideoViewUrl (uuid: string) { | 56 | getVideoViewUrl (uuid: string) { |
@@ -293,6 +294,16 @@ export class VideoService implements VideosProvider { | |||
293 | return this.buildBaseFeedUrls(params) | 294 | return this.buildBaseFeedUrls(params) |
294 | } | 295 | } |
295 | 296 | ||
297 | async getVideoSubscriptionFeedUrls (accountId: number) { | ||
298 | let params = this.restService.addRestGetParams(new HttpParams()) | ||
299 | params = params.set('accountId', accountId.toString()) | ||
300 | |||
301 | const { feedToken } = await this.authService.getScopedTokens() | ||
302 | params = params.set('token', feedToken) | ||
303 | |||
304 | return this.buildBaseFeedUrls(params) | ||
305 | } | ||
306 | |||
296 | getVideoFileMetadata (metadataUrl: string) { | 307 | getVideoFileMetadata (metadataUrl: string) { |
297 | return this.authHttp | 308 | return this.authHttp |
298 | .get<VideoFileMetadata>(metadataUrl) | 309 | .get<VideoFileMetadata>(metadataUrl) |
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.html b/client/src/app/shared/shared-video-miniature/abstract-video-list.html index b1ac757db..18294513f 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.html +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.html | |||
@@ -8,9 +8,25 @@ | |||
8 | 8 | ||
9 | <div class="action-block"> | 9 | <div class="action-block"> |
10 | <my-feed *ngIf="titlePage" [syndicationItems]="syndicationItems"></my-feed> | 10 | <my-feed *ngIf="titlePage" [syndicationItems]="syndicationItems"></my-feed> |
11 | <a [routerLink]="action.routerLink" routerLinkActive="active" *ngFor="let action of actions"> | 11 | <ng-container *ngFor="let action of actions"> |
12 | <my-button [icon]="action.iconName" [label]="action.label"></my-button> | 12 | <a *ngIf="action.routerLink" class="ml-2" [routerLink]="action.routerLink" routerLinkActive="active"> |
13 | </a> | 13 | <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container> |
14 | </a> | ||
15 | <a *ngIf="!action.routerLink && action.click && !action.clipboard" class="ml-2" (click)="action.click()" (key.enter)="action.click()"> | ||
16 | <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container> | ||
17 | </a> | ||
18 | <a *ngIf="!action.routerLink && !action.click && action.clipboard" class="ml-2" [cdkCopyToClipboard]="action.clipboard"> | ||
19 | <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container> | ||
20 | </a> | ||
21 | <a *ngIf="!action.routerLink && action.click && action.clipboard" class="ml-2" (click)="action.click()" (key.enter)="action.click()" [cdkCopyToClipboard]="action.clipboard"> | ||
22 | <ng-container *ngTemplateOutlet="actionContent; context:{ $implicit: action }"></ng-container> | ||
23 | </a> | ||
24 | |||
25 | <ng-template #actionContent let-action> | ||
26 | <my-button *ngIf="!action.justIcon" [icon]="action.iconName" [label]="action.label"></my-button> | ||
27 | <my-button *ngIf="action.justIcon" [icon]="action.iconName" [ngbTooltip]="action.label"></my-button> | ||
28 | </ng-template> | ||
29 | </ng-container> | ||
14 | </div> | 30 | </div> |
15 | 31 | ||
16 | <div class="moderation-block" *ngIf="displayModerationBlock"> | 32 | <div class="moderation-block" *ngIf="displayModerationBlock"> |
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index 2219ced30..c55e85afe 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts | |||
@@ -70,9 +70,12 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
70 | } | 70 | } |
71 | 71 | ||
72 | actions: { | 72 | actions: { |
73 | routerLink: string | ||
74 | iconName: GlobalIconName | 73 | iconName: GlobalIconName |
75 | label: string | 74 | label: string |
75 | justIcon?: boolean | ||
76 | routerLink?: string | ||
77 | click?: Function | ||
78 | clipboard?: string | ||
76 | }[] = [] | 79 | }[] = [] |
77 | 80 | ||
78 | onDataSubject = new Subject<any[]>() | 81 | onDataSubject = new Subject<any[]>() |