From cb0eda5602a21d1626a7face32de6153ed07b5f9 Mon Sep 17 00:00:00 2001 From: Alecks Gates Date: Mon, 22 May 2023 09:00:05 -0500 Subject: Add Podcast RSS feeds (#5487) * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Initial test implementation of Podcast RSS This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option. I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort. * Update to pfeed-podcast 1.2.2 * Add correct feed image to RSS channel * Prefer HLS videos for podcast RSS Remove video/stream titles, add optional height attribute to podcast RSS * Prefix podcast RSS images with root server URL * Add optional video query support to include captions * Add transcripts & person images to podcast RSS feed * Prefer webseed/webtorrent files over HLS fragmented mp4s * Experimentally adding podcast fields to basic config page * Add validation for new basic config fields * Don't include "content" in podcast feed, use full description for "description" * Add medium/socialInteract to podcast RSS feeds. Use HTML for description * Change base production image to bullseye, install prosody in image * Add liveItem and trackers to Podcast RSS feeds Remove height from alternateEnclosure, replaced with title. * Clear Podcast RSS feed cache when live streams start/end * Upgrade to Node 16 * Refactor clearCacheRoute to use ApiCache * Remove unnecessary type hint * Update dockerfile to node 16, install python-is-python2 * Use new file paths for captions/playlists * Fix legacy videos in RSS after migration to object storage * Improve method of identifying non-fragmented mp4s in podcast RSS feeds * Don't include fragmented MP4s in podcast RSS feeds * Add experimental support for podcast:categories on the podcast RSS item * Fix undefined category when no videos exist Allows for empty feeds to exist (important for feeds that might only go live) * Add support for podcast:locked -- user has to opt in to show their email * Use comma for podcast:categories delimiter * Make cache clearing async * Fix merge, temporarily test with pfeed-podcast * Syntax changes * Add EXT_MIMETYPE constants for captions * Update & fix tests, fix enclosure mimetypes, remove admin email * Add test for podacst:socialInteract * Add filters hooks for podcast customTags * Remove showdown, updated to pfeed-podcast 6.1.2 * Add 'action:api.live-video.state.updated' hook * Avoid assigning undefined category to podcast feeds * Remove nvmrc * Remove comment * Remove unused podcast config * Remove more unused podcast config * Fix MChannelAccountDefault type hint missed in merge * Remove extra line * Re-add newline in config * Fix lint errors for isEmailPublic * Fix thumbnails in podcast feeds * Requested changes based on review * Provide podcast rss 2.0 only on video channels * Misc cleanup for a less messy PR * Lint fixes * Remove pfeed-podcast * Add peertube version to new hooks * Don't use query include, remove TODO * Remove film medium hack * Clear podcast rss cache before video/channel update hooks * Clear podcast rss cache before video uploaded/deleted hooks * Refactor podcast feed cache clearing * Set correct person name from video channel * Styling * Fix tests --------- Co-authored-by: Chocobozzz --- .../my-account-change-email.component.ts | 5 ++- .../my-account-email-preferences/index.ts | 1 + .../my-account-email-preferences.component.html | 15 +++++++ .../my-account-email-preferences.component.scss | 0 .../my-account-email-preferences.component.ts | 51 ++++++++++++++++++++++ .../my-account-settings.component.html | 4 +- client/src/app/+my-account/my-account.module.ts | 5 ++- client/src/app/core/users/user.model.ts | 1 + .../app/shared/shared-main/video/video.service.ts | 11 ++++- 9 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 client/src/app/+my-account/my-account-settings/my-account-email-preferences/index.ts create mode 100644 client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.html create mode 100644 client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.scss create mode 100644 client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts (limited to 'client/src/app') diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts index 235fbec4a..ebb7ed2da 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts @@ -1,7 +1,7 @@ import { forkJoin } from 'rxjs' import { tap } from 'rxjs/operators' import { Component, OnInit } from '@angular/core' -import { AuthService, ServerService, UserService } from '@app/core' +import { AuthService, Notifier, ServerService, UserService } from '@app/core' import { USER_EMAIL_VALIDATOR, USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' import { HttpStatusCode, User } from '@shared/models' @@ -20,7 +20,8 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni protected formReactiveService: FormReactiveService, private authService: AuthService, private userService: UserService, - private serverService: ServerService + private serverService: ServerService, + private notifier: Notifier ) { super() } diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/index.ts b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/index.ts new file mode 100644 index 000000000..20b98e7d8 --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/index.ts @@ -0,0 +1 @@ +export * from './my-account-email-preferences.component' diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.html b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.html new file mode 100644 index 000000000..c4fe52743 --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.html @@ -0,0 +1,15 @@ +
+ +
+ + + Necessary to claim podcast RSS feeds. + + +
+ + +
diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.scss b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts new file mode 100644 index 000000000..7fd59d7c8 --- /dev/null +++ b/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts @@ -0,0 +1,51 @@ +import { Subject } from 'rxjs' +import { Component, Input, OnInit } from '@angular/core' +import { Notifier, UserService } from '@app/core' +import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' +import { User, UserUpdateMe } from '@shared/models' + +@Component({ + selector: 'my-account-email-preferences', + templateUrl: './my-account-email-preferences.component.html', + styleUrls: [ './my-account-email-preferences.component.scss' ] +}) +export class MyAccountEmailPreferencesComponent extends FormReactive implements OnInit { + @Input() user: User = null + @Input() userInformationLoaded: Subject + + constructor ( + protected formReactiveService: FormReactiveService, + private userService: UserService, + private notifier: Notifier + ) { + super() + } + + ngOnInit () { + this.buildForm({ + 'email-public': null + }) + + this.userInformationLoaded.subscribe(() => { + this.form.patchValue({ 'email-public': this.user.emailPublic }) + }) + } + + updateEmailPublic () { + const details: UserUpdateMe = { + emailPublic: this.form.value['email-public'] + } + + this.userService.updateMyProfile(details) + .subscribe({ + next: () => { + if (details.emailPublic) this.notifier.success($localize`Email is now public`) + else this.notifier.success($localize`Email is now private`) + + this.user.emailPublic = details.emailPublic + }, + + error: err => console.log(err.message) + }) + } +} diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index 666205de6..3986354c1 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html @@ -68,7 +68,7 @@
- +
@@ -78,6 +78,8 @@
+ +
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 84b057647..673bd2837 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts @@ -22,6 +22,7 @@ import { MyAccountRoutingModule } from './my-account-routing.module' import { MyAccountChangeEmailComponent } from './my-account-settings/my-account-change-email' import { MyAccountChangePasswordComponent } from './my-account-settings/my-account-change-password/my-account-change-password.component' import { MyAccountDangerZoneComponent } from './my-account-settings/my-account-danger-zone' +import { MyAccountEmailPreferencesComponent } from './my-account-settings/my-account-email-preferences' import { MyAccountNotificationPreferencesComponent } from './my-account-settings/my-account-notification-preferences' import { MyAccountProfileComponent } from './my-account-settings/my-account-profile/my-account-profile.component' import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component' @@ -65,7 +66,9 @@ import { MyAccountComponent } from './my-account.component' MyAccountAbusesListComponent, MyAccountServerBlocklistComponent, MyAccountNotificationsComponent, - MyAccountNotificationPreferencesComponent + MyAccountNotificationPreferencesComponent, + + MyAccountEmailPreferencesComponent ], exports: [ diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts index 5534bca33..2d783145f 100644 --- a/client/src/app/core/users/user.model.ts +++ b/client/src/app/core/users/user.model.ts @@ -19,6 +19,7 @@ export class User implements UserServerModel { pendingEmail: string | null emailVerified: boolean + emailPublic: boolean nsfwPolicy: NSFWPolicyType adminFlags?: UserAdminFlag 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 152149827..78a49567f 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -54,6 +54,7 @@ export type CommonVideoParams = { export class VideoService { static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos' static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' + static PODCAST_FEEDS_URL = environment.apiUrl + '/feeds/podcast/videos.xml' static BASE_SUBSCRIPTION_FEEDS_URL = environment.apiUrl + '/feeds/subscriptions.' constructor ( @@ -266,7 +267,15 @@ export class VideoService { let params = this.restService.addRestGetParams(new HttpParams()) params = params.set('videoChannelId', videoChannelId.toString()) - return this.buildBaseFeedUrls(params) + const feedUrls = this.buildBaseFeedUrls(params) + + feedUrls.push({ + format: FeedFormat.RSS, + label: 'podcast rss 2.0', + url: VideoService.PODCAST_FEEDS_URL + `?videoChannelId=${videoChannelId}` + }) + + return feedUrls } getVideoSubscriptionFeedUrls (accountId: number, feedToken: string) { -- cgit v1.2.3