From afff310e50f2fa8419bb4242470cbde46ab54463 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Thu, 13 Aug 2020 15:07:23 +0200 Subject: allow private syndication feeds via a user feedToken --- .../video-user-subscriptions.component.ts | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'client/src/app/+videos') diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts index 6988c574b..10031d6cc 100644 --- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts @@ -3,9 +3,12 @@ import { ActivatedRoute, Router } from '@angular/router' import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' import { HooksService } from '@app/core/plugins/hooks.service' import { immutableAssign } from '@app/helpers' +import { VideoService } from '@app/shared/shared-main' import { UserSubscriptionService } from '@app/shared/shared-user-subscription' import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature' -import { VideoSortField } from '@shared/models' +import { VideoSortField, FeedFormat } from '@shared/models' +import { copyToClipboard } from '../../../root-helpers/utils' +import { environment } from '../../../environments/environment' @Component({ selector: 'my-videos-user-subscriptions', @@ -28,11 +31,13 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement protected screenService: ScreenService, protected storageService: LocalStorageService, private userSubscription: UserSubscriptionService, - private hooks: HooksService + private hooks: HooksService, + private videoService: VideoService ) { super() this.titlePage = $localize`Videos from your subscriptions` + this.actions.push({ routerLink: '/my-library/subscriptions', label: $localize`Subscriptions`, @@ -42,6 +47,20 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement ngOnInit () { super.ngOnInit() + + const user = this.authService.getUser() + let feedUrl = environment.embedUrl + this.videoService.getVideoSubscriptionFeedUrls(user.account.id) + .then((feeds: any) => feedUrl = feedUrl + feeds.find((f: any) => f.format === FeedFormat.RSS).url) + this.actions.unshift({ + label: $localize`Feed`, + iconName: 'syndication', + justIcon: true, + click: () => { + copyToClipboard(feedUrl) + this.activateCopiedMessage() + } + }) } ngOnDestroy () { @@ -68,4 +87,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement generateSyndicationList () { // not implemented yet } + + activateCopiedMessage () { + this.notifier.success($localize`Feed URL copied`) + } } -- cgit v1.2.3