Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Improve podcast UX

Chocobozzz05cfae80deb7
diff --git a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts b/client/src/app/+admin/overview/users/user-edit/user-create.component.ts
index 3ac42a3a30..11859512d4 100644
--- a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts
+++ b/client/src/app/+admin/overview/users/user-edit/user-create.component.ts
@@ -1,11 +1,11 @@
import { CommonModule, NgTemplateOutlet } from '@angular/common'
-import { Component, OnInit, inject, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Router, RouterLink } from '@angular/router'
import { AuthService, Notifier, ScreenService, ServerService } from '@app/core'
+import { REQUIRED_EMAIL_VALIDATOR } from '@app/shared/form-validators/common-validators'
import {
USER_CHANNEL_NAME_VALIDATOR,
- USER_EMAIL_VALIDATOR,
USER_ROLE_VALIDATOR,
USER_USERNAME_VALIDATOR,
USER_VIDEO_QUOTA_DAILY_VALIDATOR,
@@ -82,7 +82,7 @@ export class UserCreateComponent extends UserEdit implements OnInit {
this.buildForm({
username: USER_USERNAME_VALIDATOR,
channelName: USER_CHANNEL_NAME_VALIDATOR,
- email: USER_EMAIL_VALIDATOR,
+ email: REQUIRED_EMAIL_VALIDATOR,
password: this.isPasswordOptional()
? getUserNewPasswordOptionalValidator(passwordConstraints.minLength, passwordConstraints.maxLength)
diff --git a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
index 969ed1ea36..c5a120ef20 100644
--- a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts
@@ -1,10 +1,10 @@
import { CommonModule, NgTemplateOutlet } from '@angular/common'
-import { Component, OnDestroy, OnInit, inject, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, inject } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core'
+import { REQUIRED_EMAIL_VALIDATOR } from '@app/shared/form-validators/common-validators'
import {
- USER_EMAIL_VALIDATOR,
USER_ROLE_VALIDATOR,
USER_VIDEO_QUOTA_DAILY_VALIDATOR,
USER_VIDEO_QUOTA_VALIDATOR
@@ -12,6 +12,7 @@ import {
import { AdminConfigService } from '@app/shared/shared-admin/admin-config.service'
import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
+import { AccountTokenSessionsComponent } from '@app/shared/shared-users/account-token-sessions.component'
import { TwoFactorService } from '@app/shared/shared-users/two-factor.service'
import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
import { UserAdminFlag, UserRole, User as UserType, UserUpdate } from '@peertube/peertube-models'
@@ -24,7 +25,6 @@ import { BytesPipe } from '../../../../shared/shared-main/common/bytes.pipe'
import { UserRealQuotaInfoComponent } from '../../../shared/user-real-quota-info.component'
import { UserEdit } from './user-edit'
import { UserPasswordComponent } from './user-password.component'
-import { AccountTokenSessionsComponent } from '@app/shared/shared-users/account-token-sessions.component'
@Component({
selector: 'my-user-update',
@@ -81,7 +81,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
}
this.buildForm({
- email: USER_EMAIL_VALIDATOR,
+ email: REQUIRED_EMAIL_VALIDATOR,
role: USER_ROLE_VALIDATOR,
videoQuota: USER_VIDEO_QUOTA_VALIDATOR,
videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR,
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 7babf410ed..d0271fc49a 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,9 +1,9 @@
import { CommonModule, NgClass } from '@angular/common'
-import { Component, OnInit, inject, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { AuthService, ServerService, UserService } from '@app/core'
+import { REQUIRED_EMAIL_VALIDATOR } from '@app/shared/form-validators/common-validators'
import { LOGIN_PASSWORD_VALIDATOR } from '@app/shared/form-validators/login-validators'
-import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
import { FormReactive } from '@app/shared/shared-forms/form-reactive'
import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
@@ -32,7 +32,7 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni
ngOnInit () {
this.buildForm({
- 'new-email': USER_EMAIL_VALIDATOR,
+ 'new-email': REQUIRED_EMAIL_VALIDATOR,
'password': LOGIN_PASSWORD_VALIDATOR
})
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
deleted file mode 100644
index a18d0c0459..0000000000
--- a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<form (ngSubmit)="updateEmailPublic()" [formGroup]="form">
-
- <div class="form-group">
- <my-peertube-checkbox inputName="email-public" formControlName="email-public">
- <ng-template ptTemplate="label">
- <ng-container i18n>Allow email <strong>{{ user().email }}</strong> to be publicly displayed</ng-container>
- </ng-template>
-
- <ng-container ngProjectAs="description">
- <p class="mb-0">
- @if (user().emailVerified) {
- <ng-container i18n>Necessary to claim podcast RSS feeds.</ng-container>
- } @else {
- <ng-container i18n>⚠️ Your email cannot be used in podcast RSS feeds because it has not yet been verified.</ng-container>
- }
- </p>
- </ng-container>
- </my-peertube-checkbox>
- </div>
-
- <input class="peertube-button primary-button" type="submit" i18n-value value="Save email settings" [disabled]="!form.valid">
-</form>
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
deleted file mode 100644
index e69de29bb2..0000000000
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
deleted file mode 100644
index 8ad87a125e..0000000000
--- a/client/src/app/+my-account/my-account-settings/my-account-email-preferences/my-account-email-preferences.component.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { Component, OnInit, inject, model, ChangeDetectionStrategy } from '@angular/core'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { Notifier, UserService } from '@app/core'
-import { FormReactive } from '@app/shared/shared-forms/form-reactive'
-import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
-import { PeerTubeTemplateDirective } from '@app/shared/shared-main/common/peertube-template.directive'
-import { User, UserUpdateMe } from '@peertube/peertube-models'
-import { PeertubeCheckboxComponent } from '../../../shared/shared-forms/peertube-checkbox.component'
-
-@Component({
- selector: 'my-account-email-preferences',
- templateUrl: './my-account-email-preferences.component.html',
- styleUrls: [ './my-account-email-preferences.component.scss' ],
- changeDetection: ChangeDetectionStrategy.Eager,
- imports: [ FormsModule, ReactiveFormsModule, PeertubeCheckboxComponent, PeerTubeTemplateDirective ]
-})
-export class MyAccountEmailPreferencesComponent extends FormReactive implements OnInit {
- protected formReactiveService = inject(FormReactiveService)
- private userService = inject(UserService)
- private notifier = inject(Notifier)
-
- readonly user = model<User>(undefined)
-
- checkboxLabel: string
-
- ngOnInit () {
- this.buildForm({
- 'email-public': null
- })
-
- this.form.patchValue({ 'email-public': this.user().emailPublic })
-
- this.checkboxLabel = $localize``
- }
-
- 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.update(u => ({ ...u, emailPublic: details.emailPublic }))
- },
-
- error: err => this.notifier.handleError(err)
- })
- }
-}
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 2af17b5c31..3d31a7c184 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
@@ -88,19 +88,18 @@
</div>
</div>
-<div class="pt-two-cols mt-5"> <!-- email grid -->
- <div class="title-col">
- <h2 i18n>EMAIL</h2>
- </div>
- <div class="content-col">
- <my-account-email-preferences class="d-block mb-5" [user]="user"></my-account-email-preferences>
+@if (user.pluginAuth === null) {
+ <div class="pt-two-cols mt-5"> <!-- email grid -->
+ <div class="title-col">
+ <h2 i18n>EMAIL</h2>
+ </div>
- @if (user.pluginAuth === null) {
- <my-account-change-email></my-account-change-email>
- }
+ <div class="content-col">
+ <my-account-change-email></my-account-change-email>
+ </div>
</div>
-</div>
+}
<div class="pt-two-cols mt-5"> <!-- danger zone grid -->
<div class="title-col">
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
index f31e7c682b..c0bdf8c9df 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts
@@ -1,6 +1,6 @@
import { ViewportScroller } from '@angular/common'
import { HttpErrorResponse } from '@angular/common/http'
-import { AfterViewChecked, Component, OnInit, inject, ChangeDetectionStrategy } from '@angular/core'
+import { AfterViewChecked, ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'
import { AuthService, Notifier, User, UserService } from '@app/core'
import { genericUploadErrorHandler } from '@app/helpers'
import { shallowCopy } from '@peertube/peertube-core-utils'
@@ -12,7 +12,6 @@ import { AccountTokenSessionsComponent } from '../../shared/shared-users/account
import { MyAccountChangeEmailComponent } from './my-account-change-email/my-account-change-email.component'
import { MyAccountChangePasswordComponent } from './my-account-change-password/my-account-change-password.component'
import { MyAccountDangerZoneComponent } from './my-account-danger-zone/my-account-danger-zone.component'
-import { MyAccountEmailPreferencesComponent } from './my-account-email-preferences/my-account-email-preferences.component'
import {
MyAccountNotificationPreferencesComponent
} from './my-account-notification-preferences/my-account-notification-preferences.component'
@@ -33,7 +32,6 @@ import { MyAccountTwoFactorButtonComponent } from './my-account-two-factor/my-ac
MyAccountNotificationPreferencesComponent,
MyAccountChangePasswordComponent,
MyAccountTwoFactorButtonComponent,
- MyAccountEmailPreferencesComponent,
MyAccountChangeEmailComponent,
MyAccountDangerZoneComponent,
AccountTokenSessionsComponent
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.scss b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.scss
index c1ecca9039..1f669aff2c 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.scss
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.scss
@@ -10,10 +10,6 @@ input[type="text"] {
@include peertube-input-text(340px);
}
-input[type="submit"] {
- @include margin-left(auto);
-}
-
.markdown-block {
max-width: 500px;
}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.ts b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.ts
index bd64089312..82c799c4d9 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-general.component.ts
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common'
-import { Component, inject, OnDestroy, OnInit, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, OnDestroy, OnInit, viewChild } from '@angular/core'
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Router } from '@angular/router'
import { AuthService, ConfirmService, Notifier } from '@app/core'
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.html b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.html
new file mode 100644
index 0000000000..8e0f462c4b
--- /dev/null
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.html
@@ -0,0 +1,112 @@
+<h2 class="form-title">
+ <my-global-icon iconName="syndication"></my-global-icon>
+
+ <ng-container i18n>Podcast</ng-container>
+</h2>
+
+<form role="form">
+ @if (mode === 'update') {
+ <div class="pt-two-cols">
+ <div class="title-col">
+ <h3 i18n>PODCAST APPLICATIONS</h3>
+ </div>
+
+ <div class="content-col">
+ <div class="form-group">
+ <label for="podcast-feed-audio" i18n>Podcast feed - Audio & Video</label>
+
+ <div class="form-group-description" i18n>
+ This feed contains both audio and video enclosures so podcast clients can choose their preferred format
+ </div>
+
+ <my-input-text
+ inputId="podcast-feed-audio"
+ [show]="true"
+ [readonly]="true"
+ [withCopy]="true"
+ [withToggle]="false"
+ [value]="podcastFeedUrl"
+ i18n-copiedNotification
+ copiedNotification="Podcast feed URL copied to clipboard!"
+ ></my-input-text>
+ </div>
+ </div>
+ </div>
+
+ <div class="pt-two-cols">
+ <div class="title-col">
+ <h3 i18n>APPLE PODCAST</h3>
+ </div>
+
+ <div class="content-col">
+
+ @if (!formModel().publicEmail) {
+ <my-alert type="warning" i18n>
+ Apple Podcast requires a public email to be set in order to submit your podcast.
+ </my-alert>
+ }
+
+ @if (hasAudioTranscodingEnabled()) {
+ <div class="form-group">
+ <label for="podcast-feed-audio" i18n>Apple Podcast - Audio</label>
+
+ <div class="form-group-description" i18n>
+ Use this URL in Apple Podcast if you only want to broadcast only the audio from your videos
+ </div>
+
+ <my-input-text
+ inputId="podcast-feed-audio"
+ [show]="true"
+ [readonly]="true"
+ [withCopy]="true"
+ [withToggle]="false"
+ [value]="audioFeedUrl"
+ i18n-copiedNotification
+ copiedNotification="Apple Podcast feed URL for audio copied to clipboard!"
+ ></my-input-text>
+ </div>
+ }
+
+ <div class="form-group">
+ <label for="podcast-feed-video" i18n>Apple Podcast - Video</label>
+
+ <div class="form-group-description" i18n>
+ Use this URL in Apple Podcast if you only want to broadcast your videos
+ </div>
+
+ <my-input-text
+ inputId="podcast-feed-video"
+ [show]="true"
+ [readonly]="true"
+ [withCopy]="true"
+ [withToggle]="false"
+ [value]="videoFeedUrl"
+ i18n-copiedNotification
+ copiedNotification="Apple Podcast feed URL for videos copied to clipboard!"
+ ></my-input-text>
+ </div>
+ </div>
+ </div>
+ }
+
+ <div class="pt-two-cols">
+ <div class="title-col">
+ <h3 i18n>PODCAST SETTINGS</h3>
+ </div>
+
+ <div class="content-col">
+ <div class="form-group">
+ <label i18n for="publicEmail">Public email</label>
+
+ <div i18n class="form-group-description">
+ This email will be publicly exposed in podcast RSS feeds, allowing you to prove ownership of your feed. This is required to submit your podcast to
+ Apple Podcast
+ </div>
+
+ <input type="email" id="publicEmail" class="form-control" [formField]="form.publicEmail" [myFormInputError]="form.publicEmail()">
+
+ <my-form-error [field]="form.publicEmail()"></my-form-error>
+ </div>
+ </div>
+ </div>
+</form>
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.scss b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.scss
new file mode 100644
index 0000000000..bd5dc94866
--- /dev/null
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.scss
@@ -0,0 +1,7 @@
+@use "_variables" as *;
+@use "_mixins" as *;
+@use "_form-mixins" as *;
+
+.content-col {
+ max-width: 600px;
+}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.ts b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.ts
new file mode 100644
index 0000000000..cfa98df5c4
--- /dev/null
+++ b/client/src/app/+my-library/+my-video-channels/edit/pages/video-channel-edit-podcast.component.ts
@@ -0,0 +1,134 @@
+import { CommonModule } from '@angular/common'
+import { ChangeDetectionStrategy, Component, effect, inject, Injector, OnDestroy, OnInit, signal } from '@angular/core'
+import { FormsModule, ReactiveFormsModule } from '@angular/forms'
+import { email, form, FormField } from '@angular/forms/signals'
+import { ServerService } from '@app/core'
+import { FormErrorComponent } from '@app/shared/shared-forms/form-error.component'
+import { FormInputErrorDirective } from '@app/shared/shared-forms/form-input-error.directive'
+import { InputTextComponent } from '@app/shared/shared-forms/input-text.component'
+import { GlobalIconComponent } from '@app/shared/shared-icons/global-icon.component'
+import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
+import { getChannelPodcastFeed } from '@peertube/peertube-core-utils'
+import { VideoResolution } from '@peertube/peertube-models'
+import { Subscription } from 'rxjs'
+import { environment } from '../../../../../environments/environment'
+import { VideoChannelEditControllerService } from '../video-channel-edit-controller.service'
+import { VideoChannelEdit } from '../video-channel-edit.model'
+
+@Component({
+ selector: 'my-video-channel-edit-podcast',
+ templateUrl: './video-channel-edit-podcast.component.html',
+ styleUrls: [ './video-channel-edit-podcast.component.scss' ],
+ changeDetection: ChangeDetectionStrategy.Eager,
+ imports: [
+ CommonModule,
+ FormsModule,
+ ReactiveFormsModule,
+ GlobalIconComponent,
+ InputTextComponent,
+ FormErrorComponent,
+ FormField,
+ FormInputErrorDirective,
+ AlertComponent
+ ]
+})
+export class VideoChannelEditPodcastComponent implements OnInit, OnDestroy {
+ private readonly injector = inject(Injector)
+ private readonly server = inject(ServerService)
+
+ private editController = inject(VideoChannelEditControllerService)
+
+ videoChannelEdit: VideoChannelEdit
+
+ readonly formModel = signal<{ publicEmail: string }>({
+ publicEmail: null
+ })
+
+ readonly form = form(this.formModel, f => {
+ email(f.publicEmail, { message: $localize`Email must be valid.` })
+ })
+
+ mode: string
+
+ private storeSub: Subscription
+ private formSub: Subscription
+
+ get videoFeedUrl () {
+ return getChannelPodcastFeed(environment.originServerUrl, { id: this.videoChannelEdit.apiInfo.id }, 'video')
+ }
+
+ get audioFeedUrl () {
+ return getChannelPodcastFeed(environment.originServerUrl, { id: this.videoChannelEdit.apiInfo.id }, 'audio')
+ }
+
+ get podcastFeedUrl () {
+ return getChannelPodcastFeed(environment.originServerUrl, { id: this.videoChannelEdit.apiInfo.id })
+ }
+
+ ngOnInit () {
+ this.mode = this.editController.getMode()
+
+ this.videoChannelEdit = this.editController.getStore()
+
+ this.buildForm()
+
+ this.storeSub = this.editController.getStoreChangesObs()
+ .subscribe(() => {
+ this.videoChannelEdit = this.editController.getStore()
+
+ this.buildForm()
+ })
+
+ this.editController.registerSaveHook(() => {
+ this.editController.setFormError($localize`Podcast`, 'podcast', this.form().errorSummary())
+ })
+
+ let firstRun = true
+
+ effect(() => {
+ // Register signal to trigger effect when form model changes
+ const model = this.formModel()
+
+ if (firstRun) {
+ firstRun = false
+ return
+ }
+
+ setTimeout(() => {
+ this.editController.setFormError($localize`Podcast`, 'podcast', {})
+
+ this.videoChannelEdit.loadFromPodcastForm({
+ channel: {
+ publicEmail: model.publicEmail || null
+ }
+ })
+ })
+ }, { injector: this.injector })
+ }
+
+ ngOnDestroy () {
+ this.storeSub?.unsubscribe()
+ this.formSub?.unsubscribe()
+ }
+
+ private buildForm () {
+ this.formModel.set({
+ publicEmail: this.videoChannelEdit.channel.publicEmail
+ })
+ }
+
+ hasAudioTranscodingEnabled () {
+ const config = this.server.getHTMLConfig().transcoding
+
+ // Transcode to an audio resolution
+ if (
+ (config.web_videos.enabled || config.hls.enabled) &&
+ (config.enabledResolutions.includes(VideoResolution.H_NOVIDEO) || config.alwaysTranscodePodcastOptimizedAudio)
+ ) return true
+
+ // Or if HLS transcoding splits audio and video streams
+ if (config.hls.enabled && config.hls.splitAudioAndVideo) return true
+
+ return false
+ }
+}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit-controller.service.ts b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit-controller.service.ts
index a22e448a0f..19983e7dae 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit-controller.service.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit-controller.service.ts
@@ -1,8 +1,9 @@
import { inject, Injectable } from '@angular/core'
+import { ValidationError } from '@angular/forms/signals'
import { FormReactiveErrors } from '@app/shared/form-validators/form-validator.model'
import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
-import { VideoChannelEdit } from './video-channel-edit.model'
import { Subject } from 'rxjs'
+import { VideoChannelEdit } from './video-channel-edit.model'
export type EditMode = 'create' | 'update'
@@ -59,8 +60,11 @@ export class VideoChannelEditControllerService {
// ---------------------------------------------------------------------------
- setFormError (page: string, path: string, formErrors: FormReactiveErrors) {
- const errors = this.formReactiveService.grabAllErrors(formErrors)
+ setFormError (page: string, path: string, formErrors: FormReactiveErrors | ValidationError.WithFieldTree[]) {
+ const errors = Array.isArray(formErrors)
+ ? formErrors.map(e => e.message)
+ : this.formReactiveService.grabAllErrors(formErrors)
+
this.formErrors = this.formErrors.filter(e => e.page !== page)
if (errors.length === 0) return
diff --git a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.html b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.html
index 9ec30c4c8d..2d8bc6b8ee 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.html
+++ b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.html
@@ -8,7 +8,6 @@
<div class="actions header-block">
<my-button class="cancel-button" icon="arrow-left" theme="secondary" i18n [ptRouterLink]="cancelLink()">Cancel</my-button>
-
@if (mode === 'update') {
<h2>
<my-action-dropdown
diff --git a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.ts b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.ts
index 9350428455..63aa777442 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.component.ts
@@ -1,4 +1,4 @@
-import { Component, inject, input, OnDestroy, OnInit, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, inject, input, OnDestroy, OnInit } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { RouterModule, RouterOutlet } from '@angular/router'
import { AuthService } from '@app/core'
@@ -73,6 +73,14 @@ export class VideoChannelEditComponent implements OnInit, OnDestroy {
isDisplayed: () => this.mode === 'update'
},
+ {
+ type: 'link',
+ icon: 'syndication',
+ label: $localize`Podcast`,
+ routerLink: 'podcast',
+ isDisplayed: () => this.mode === 'update'
+ },
+
{
type: 'separator'
},
diff --git a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.model.ts b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.model.ts
index 3824463f27..2a1d0c12cd 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.model.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.model.ts
@@ -16,6 +16,12 @@ type GeneralFormValue = {
}
}
+type PodcastFormValue = {
+ channel: {
+ publicEmail: string
+ }
+}
+
export class VideoChannelEdit {
avatar: FormData
banner: FormData
@@ -29,6 +35,7 @@ export class VideoChannelEdit {
displayName: string
description: string
support: string
+ publicEmail: string
bulkVideosSupportUpdate: boolean
}
@@ -63,6 +70,7 @@ export class VideoChannelEdit {
displayName: '',
description: '',
support: '',
+ publicEmail: null,
bulkVideosSupportUpdate: false
}
@@ -95,6 +103,7 @@ export class VideoChannelEdit {
displayName: channel.displayName,
description: channel.description,
support: channel.support,
+ publicEmail: channel.publicEmail,
bulkVideosSupportUpdate: false
}
@@ -128,6 +137,17 @@ export class VideoChannelEdit {
this.channel = {
...this.channel,
+
+ ...form.channel
+ }
+
+ this.commonChanged = true
+ }
+
+ loadFromPodcastForm (form: PodcastFormValue) {
+ this.channel = {
+ ...this.channel,
+
...form.channel
}
diff --git a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.routes.ts b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.routes.ts
index cb47358799..fbfc586792 100644
--- a/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.routes.ts
+++ b/client/src/app/+my-library/+my-video-channels/edit/video-channel-edit.routes.ts
@@ -2,6 +2,7 @@ import { Routes } from '@angular/router'
import { VideoChannelActivitiesComponent } from './pages/video-channel-activities.component'
import { VideoChannelEditGeneralComponent } from './pages/video-channel-edit-general.component'
import { VideoChannelEditEditorsComponent } from './pages/video-channel-editors.component'
+import { VideoChannelEditPodcastComponent } from './pages/video-channel-edit-podcast.component'
export const videoChannelEditRoutes: Routes = [
{
@@ -18,6 +19,15 @@ export const videoChannelEditRoutes: Routes = [
}
}
},
+ {
+ path: 'podcast',
+ component: VideoChannelEditPodcastComponent,
+ data: {
+ meta: {
+ title: $localize`Channel podcast configuration`
+ }
+ }
+ },
{
path: 'editors',
component: VideoChannelEditEditorsComponent,
diff --git a/client/src/app/+my-library/+my-video-channels/video-channel-manage.component.ts b/client/src/app/+my-library/+my-video-channels/video-channel-manage.component.ts
index ed154e15a5..d27c212348 100644
--- a/client/src/app/+my-library/+my-video-channels/video-channel-manage.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/video-channel-manage.component.ts
@@ -80,6 +80,7 @@ export class VideoChannelManageComponent implements OnInit, OnDestroy, AfterView
displayName: this.videoChannelEdit.channel.displayName,
description: this.videoChannelEdit.channel.description,
support: this.videoChannelEdit.channel.support,
+ publicEmail: this.videoChannelEdit.channel.publicEmail,
bulkVideosSupportUpdate: this.videoChannelEdit.channel.bulkVideosSupportUpdate
}
diff --git a/client/src/app/+signup/+register/steps/register-step-user.component.ts b/client/src/app/+signup/+register/steps/register-step-user.component.ts
index 0513718bdb..ba1102fc35 100644
--- a/client/src/app/+signup/+register/steps/register-step-user.component.ts
+++ b/client/src/app/+signup/+register/steps/register-step-user.component.ts
@@ -1,11 +1,11 @@
import { NgClass } from '@angular/common'
-import { Component, OnInit, inject, input, output, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnInit, inject, input, output } from '@angular/core'
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'
import { SignupService } from '@app/+signup/shared/signup.service'
import { ServerService } from '@app/core'
+import { REQUIRED_EMAIL_VALIDATOR } from '@app/shared/form-validators/common-validators'
import {
USER_DISPLAY_NAME_REQUIRED_VALIDATOR,
- USER_EMAIL_VALIDATOR,
USER_USERNAME_VALIDATOR,
getUserNewPasswordValidator
} from '@app/shared/form-validators/user-validators'
@@ -49,7 +49,7 @@ export class RegisterStepUserComponent extends FormReactive implements OnInit {
displayName: USER_DISPLAY_NAME_REQUIRED_VALIDATOR,
username: USER_USERNAME_VALIDATOR,
password: passwordValidator,
- email: USER_EMAIL_VALIDATOR
+ email: REQUIRED_EMAIL_VALIDATOR
})
setTimeout(() => this.formBuilt.emit(this.form))
diff --git a/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
index 87d0d300ca..892151c672 100644
--- a/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-new-account-ask-send-email/verify-new-account-ask-send-email.component.ts
@@ -1,9 +1,9 @@
import { NgClass } from '@angular/common'
-import { Component, OnInit, inject, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { SignupService } from '@app/+signup/shared/signup.service'
import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
-import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
+import { REQUIRED_EMAIL_VALIDATOR } from '@app/shared/form-validators/common-validators'
import { FormReactive } from '@app/shared/shared-forms/form-reactive'
import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'
import { forkJoin } from 'rxjs'
@@ -36,7 +36,7 @@ export class VerifyNewAccountAskSendEmailComponent extends FormReactive implemen
})
this.buildForm({
- 'verify-email-email': USER_EMAIL_VALIDATOR
+ 'verify-email-email': REQUIRED_EMAIL_VALIDATOR
})
}
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts
index 43baf6b04c..dae4d23d5f 100644
--- a/client/src/app/+video-channels/video-channels.component.ts
+++ b/client/src/app/+video-channels/video-channels.component.ts
@@ -1,5 +1,5 @@
import { NgClass, NgTemplateOutlet } from '@angular/common'
-import { Component, OnDestroy, OnInit, inject, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, inject, viewChild } from '@angular/core'
import { ActivatedRoute, RouterLink, RouterOutlet } from '@angular/router'
import { AuthService, Hotkey, HotkeysService, MarkdownService, MetaService, RestExtractor, ScreenService, ServerService } from '@app/core'
import { getOriginUrl } from '@app/helpers'
@@ -91,7 +91,9 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
titles: {
instanceVideosFeed: `${instanceName} - Videos feed`,
channelVideosFeed: `${videoChannel.displayName} - Videos feed`,
- channelPodcastFeed: `${videoChannel.displayName} - Podcast feed`
+ channelPodcastFeed: `${videoChannel.displayName} - Podcast feed`,
+ channelPodcastAudioFeed: `${videoChannel.displayName} - Apple Podcast audio feed`,
+ channelPodcastVideoFeed: `${videoChannel.displayName} - Apple Podcast video feed`
}
})
)
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.ts
index 2049217657..32995b55f6 100644
--- a/client/src/app/+video-watch/video-watch.component.ts
+++ b/client/src/app/+video-watch/video-watch.component.ts
@@ -1,5 +1,5 @@
import { CommonModule, PlatformLocation } from '@angular/common'
-import { Component, ElementRef, inject, LOCALE_ID, NgZone, OnDestroy, OnInit, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { ChangeDetectionStrategy, Component, ElementRef, inject, LOCALE_ID, NgZone, OnDestroy, OnInit, viewChild } from '@angular/core'
import { ActivatedRoute, Params, Router, RouterLink } from '@angular/router'
import {
AuthService,
@@ -1084,7 +1084,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
playlist: this.playlist,
titles: {
instanceVideosFeed: $localize`${this.serverConfig.instance.name} - Videos feed`,
- playlistPodcastFeed: $localize`${this.playlist.displayName} - Podcast feed`
+ playlistPodcastFeed: $localize`${this.playlist.displayName} - Podcast feed`,
+ playlistPodcastAudioFeed: $localize`${this.playlist.displayName} - Apple Podcast audio feed`,
+ playlistPodcastVideoFeed: $localize`${this.playlist.displayName} - Apple Podcast video feed`
}
})
)
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts
index 1865f0cfc9..f784ffa2d4 100644
--- a/client/src/app/core/users/user.model.ts
+++ b/client/src/app/core/users/user.model.ts
@@ -20,7 +20,6 @@ export class User implements UserServerModel {
pendingEmail: string | null
emailVerified: boolean
- emailPublic: boolean
nsfwPolicy: NSFWPolicyType
nsfwFlagsDisplayed: number
diff --git a/client/src/app/shared/form-validators/common-validators.ts b/client/src/app/shared/form-validators/common-validators.ts
index b9b04aaa36..5d50faafd4 100644
--- a/client/src/app/shared/form-validators/common-validators.ts
+++ b/client/src/app/shared/form-validators/common-validators.ts
@@ -26,3 +26,11 @@ export const HEX_COLOR_CODE_VALIDATOR: BuildFormValidator = {
pattern: $localize`This field must be a valid 6-digit hexadecimal color code.`
}
}
+
+export const REQUIRED_EMAIL_VALIDATOR: BuildFormValidator = {
+ VALIDATORS: [ Validators.required, Validators.email ],
+ MESSAGES: {
+ required: $localize`Email is required.`,
+ email: $localize`Email must be valid.`
+ }
+}
diff --git a/client/src/app/shared/form-validators/user-validators.ts b/client/src/app/shared/form-validators/user-validators.ts
index 64b165f566..f8f18ad95c 100644
--- a/client/src/app/shared/form-validators/user-validators.ts
+++ b/client/src/app/shared/form-validators/user-validators.ts
@@ -33,14 +33,6 @@ export const USER_CHANNEL_NAME_VALIDATOR: BuildFormValidator = {
}
}
-export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
- VALIDATORS: [ Validators.required, Validators.email ],
- MESSAGES: {
- required: $localize`Email is required.`,
- email: $localize`Email must be valid.`
- }
-}
-
export const USER_HANDLE_VALIDATOR: BuildFormValidator = {
VALIDATORS: [
Validators.required,
diff --git a/client/src/app/shared/shared-forms/input-text.component.html b/client/src/app/shared/shared-forms/input-text.component.html
index 3ccdc350f7..f3ca600db4 100644
--- a/client/src/app/shared/shared-forms/input-text.component.html
+++ b/client/src/app/shared/shared-forms/input-text.component.html
@@ -19,7 +19,7 @@
@if (withCopy()) {
<my-copy-button
- [value]="input.value" i18n-notification notification="Copied"
+ [value]="input.value" [notification]="copiedNotification()"
[isInputGroup]="true" i18n
>COPY</my-copy-button>
}
diff --git a/client/src/app/shared/shared-forms/input-text.component.ts b/client/src/app/shared/shared-forms/input-text.component.ts
index 31ca6015a4..50e6041d5d 100644
--- a/client/src/app/shared/shared-forms/input-text.component.ts
+++ b/client/src/app/shared/shared-forms/input-text.component.ts
@@ -1,5 +1,5 @@
import { NgClass } from '@angular/common'
-import { AfterViewInit, Component, ElementRef, forwardRef, input, model, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, forwardRef, input, model, viewChild } from '@angular/core'
import { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms'
import { GlobalIconComponent } from '../shared-icons/global-icon.component'
import { CopyButtonComponent } from '../shared-main/buttons/copy-button.component'
@@ -35,6 +35,7 @@ export class InputTextComponent implements ControlValueAccessor, AfterViewInit {
readonly formError = input<string | FormReactiveErrors | FormReactiveErrors[]>(undefined)
readonly autofocus = input(false)
readonly ariaLabel = input<string>(undefined)
+ readonly copiedNotification = input<string>($localize`Copied!`)
get inputType () {
return this.show()
diff --git a/client/src/app/shared/shared-main/channel/video-channel.model.ts b/client/src/app/shared/shared-main/channel/video-channel.model.ts
index 9b1286624e..da20759634 100644
--- a/client/src/app/shared/shared-main/channel/video-channel.model.ts
+++ b/client/src/app/shared/shared-main/channel/video-channel.model.ts
@@ -6,6 +6,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
displayName: string
description: string
support: string
+ publicEmail: string
nameWithHost: string
nameWithHostForced: string
@@ -53,6 +54,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel {
this.displayName = hash.displayName
this.description = hash.description
this.support = hash.support
+ this.publicEmail = hash.publicEmail
this.banners = hash.banners || []
diff --git a/packages/core-utils/src/renderer/rss.ts b/packages/core-utils/src/renderer/rss.ts
index 2af514b7f3..d5dfdbe709 100644
--- a/packages/core-utils/src/renderer/rss.ts
+++ b/packages/core-utils/src/renderer/rss.ts
@@ -1,4 +1,4 @@
-import { VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'
+import { FeedEnclosurePreference, VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'
export function getInstanceRSSFeed (options: {
url: string
@@ -9,6 +9,9 @@ export function getInstanceRSSFeed (options: {
return { url: `${url}/feeds/videos.xml`, title }
}
+// ---------------------------------------------------------------------------
+
+
export function getChannelRSSFeeds (options: {
url: string
channel: { name: string, id: number }
@@ -16,6 +19,8 @@ export function getChannelRSSFeeds (options: {
instanceVideosFeed: string
channelVideosFeed: string
channelPodcastFeed: string
+ channelPodcastAudioFeed: string
+ channelPodcastVideoFeed: string
}
}) {
const { url, titles, channel } = options
@@ -26,6 +31,16 @@ export function getChannelRSSFeeds (options: {
title: titles.channelPodcastFeed
},
+ {
+ url: getChannelPodcastFeed(url, channel, 'audio'),
+ title: titles.channelPodcastAudioFeed
+ },
+
+ {
+ url: getChannelPodcastFeed(url, channel, 'video'),
+ title: titles.channelPodcastVideoFeed
+ },
+
{
url: `${url}/feeds/videos.xml?videoChannelId=${channel.id}`,
title: titles.channelVideosFeed
@@ -35,6 +50,16 @@ export function getChannelRSSFeeds (options: {
]
}
+export function getChannelPodcastFeed (url: string, channel: { id: number }, enclosurePreference?: FeedEnclosurePreference) {
+ const enclosurePreferenceQuery = enclosurePreference
+ ? `&enclosurePreference=${enclosurePreference}`
+ : ''
+
+ return `${url}/feeds/podcast/videos.xml?videoChannelId=${channel.id}${enclosurePreferenceQuery}`
+}
+
+// ---------------------------------------------------------------------------
+
export function getVideoRSSFeeds (options: {
url: string
video: { name: string, uuid: string, privacy: VideoPrivacyType }
@@ -59,9 +84,8 @@ export function getVideoRSSFeeds (options: {
]
}
-export function getChannelPodcastFeed (url: string, channel: { id: number }) {
- return `${url}/feeds/podcast/videos.xml?videoChannelId=${channel.id}`
-}
+// ---------------------------------------------------------------------------
+
export function getPlaylistRSSFeeds (options: {
url: string
@@ -69,6 +93,8 @@ export function getPlaylistRSSFeeds (options: {
titles: {
instanceVideosFeed: string
playlistPodcastFeed: string
+ playlistPodcastAudioFeed: string
+ playlistPodcastVideoFeed: string
}
}) {
const { url, titles, playlist } = options
@@ -79,10 +105,24 @@ export function getPlaylistRSSFeeds (options: {
title: titles.playlistPodcastFeed
},
+ {
+ url: getPlaylistPodcastFeed(url, playlist, 'audio'),
+ title: titles.playlistPodcastAudioFeed
+ },
+
+ {
+ url: getPlaylistPodcastFeed(url, playlist, 'video'),
+ title: titles.playlistPodcastVideoFeed
+ },
+
getInstanceRSSFeed({ url, title: titles.instanceVideosFeed })
]
}
-export function getPlaylistPodcastFeed (url: string, playlist: { id: number }) {
- return `${url}/feeds/podcast/videos.xml?playlistId=${playlist.id}`
+export function getPlaylistPodcastFeed (url: string, playlist: { id: number }, enclosurePreference?: FeedEnclosurePreference) {
+ const enclosurePreferenceQuery = enclosurePreference
+ ? `&enclosurePreference=${enclosurePreference}`
+ : ''
+
+ return `${url}/feeds/podcast/videos.xml?playlistId=${playlist.id}${enclosurePreferenceQuery}`
}
diff --git a/packages/models/src/activitypub/activitypub-actor.ts b/packages/models/src/activitypub/activitypub-actor.ts
index 1cb57e3370..b68aee1bbe 100644
--- a/packages/models/src/activitypub/activitypub-actor.ts
+++ b/packages/models/src/activitypub/activitypub-actor.ts
@@ -21,6 +21,9 @@ export interface ActivityPubActor {
attributedTo?: ActivityPubAttributedTo[]
support?: string
+
+ email?: string
+
publicKey: {
id: string
owner: string
diff --git a/packages/models/src/feeds/feed-format.enum.ts b/packages/models/src/feeds/feed.model.ts
similarity index 58%
rename from packages/models/src/feeds/feed-format.enum.ts
rename to packages/models/src/feeds/feed.model.ts
index 604fb67463..bff5b3eb3a 100644
--- a/packages/models/src/feeds/feed-format.enum.ts
+++ b/packages/models/src/feeds/feed.model.ts
@@ -7,9 +7,15 @@ export const FeedFormat = {
export type FeedFormatType = typeof FeedFormat[keyof typeof FeedFormat]
+// ---------------------------------------------------------------------------
+
export const FeedType = {
VIDEOS: 'videos',
PODCAST: 'podcast'
} as const
export type FeedType_Type = typeof FeedType[keyof typeof FeedType]
+
+// ---------------------------------------------------------------------------
+
+export type FeedEnclosurePreference = 'video' | 'audio' | 'm3u8'
diff --git a/packages/models/src/feeds/index.ts b/packages/models/src/feeds/index.ts
index 1eda1d6c39..bf0c66fa0b 100644
--- a/packages/models/src/feeds/index.ts
+++ b/packages/models/src/feeds/index.ts
@@ -1 +1 @@
-export * from './feed-format.enum.js'
+export * from './feed.model.js'
diff --git a/packages/models/src/import-export/peertube-export-format/channel-export.model.ts b/packages/models/src/import-export/peertube-export-format/channel-export.model.ts
index 46eaa3d00b..e9db1119b9 100644
--- a/packages/models/src/import-export/peertube-export-format/channel-export.model.ts
+++ b/packages/models/src/import-export/peertube-export-format/channel-export.model.ts
@@ -9,6 +9,7 @@ export interface ChannelExportJSON {
displayName: string
description: string
support: string
+ publicEmail: string
updatedAt: string
createdAt: string
diff --git a/packages/models/src/import-export/peertube-export-format/user-settings-export.model.ts b/packages/models/src/import-export/peertube-export-format/user-settings-export.model.ts
index 52ef259463..0ef7b8fd36 100644
--- a/packages/models/src/import-export/peertube-export-format/user-settings-export.model.ts
+++ b/packages/models/src/import-export/peertube-export-format/user-settings-export.model.ts
@@ -4,7 +4,6 @@ import { NSFWPolicyType } from '../../videos/nsfw-policy.type.js'
export interface UserSettingsExportJSON {
email: string
- emailPublic: boolean
nsfwPolicy: NSFWPolicyType
autoPlayVideo: boolean
diff --git a/packages/models/src/server/server-config.model.ts b/packages/models/src/server/server-config.model.ts
index e18493b018..84b5e7660f 100644
--- a/packages/models/src/server/server-config.model.ts
+++ b/packages/models/src/server/server-config.model.ts
@@ -229,6 +229,7 @@ export interface ServerConfig {
transcoding: {
hls: {
enabled: boolean
+ splitAudioAndVideo: boolean
}
web_videos: {
@@ -243,6 +244,9 @@ export interface ServerConfig {
remoteRunners: {
enabled: boolean
}
+
+ alwaysTranscodeOriginalResolution: boolean
+ alwaysTranscodePodcastOptimizedAudio: boolean
}
live: {
diff --git a/packages/models/src/users/user-update-me.model.ts b/packages/models/src/users/user-update-me.model.ts
index a250b9d04c..f8f6d5e7c2 100644
--- a/packages/models/src/users/user-update-me.model.ts
+++ b/packages/models/src/users/user-update-me.model.ts
@@ -20,7 +20,6 @@ export interface UserUpdateMe {
language?: string
email?: string
- emailPublic?: boolean
currentPassword?: string
password?: string
diff --git a/packages/models/src/users/user.model.ts b/packages/models/src/users/user.model.ts
index 4e40d7b426..601f9c19fe 100644
--- a/packages/models/src/users/user.model.ts
+++ b/packages/models/src/users/user.model.ts
@@ -16,7 +16,6 @@ export interface User {
pendingEmail: string | null
emailVerified: boolean
- emailPublic: boolean
nsfwPolicy: NSFWPolicyType
nsfwFlagsDisplayed: number
diff --git a/packages/models/src/videos/channel/video-channel-create.model.ts b/packages/models/src/videos/channel/video-channel-create.model.ts
index da8ce620c3..030f8d645e 100644
--- a/packages/models/src/videos/channel/video-channel-create.model.ts
+++ b/packages/models/src/videos/channel/video-channel-create.model.ts
@@ -3,4 +3,5 @@ export interface VideoChannelCreate {
displayName: string
description?: string
support?: string
+ publicEmail?: string
}
diff --git a/packages/models/src/videos/channel/video-channel-update.model.ts b/packages/models/src/videos/channel/video-channel-update.model.ts
index 8dde9188bb..be2d99e925 100644
--- a/packages/models/src/videos/channel/video-channel-update.model.ts
+++ b/packages/models/src/videos/channel/video-channel-update.model.ts
@@ -2,6 +2,7 @@ export interface VideoChannelUpdate {
displayName?: string
description?: string
support?: string
+ publicEmail?: string
bulkVideosSupportUpdate?: boolean
}
diff --git a/packages/models/src/videos/channel/video-channel.model.ts b/packages/models/src/videos/channel/video-channel.model.ts
index 4e89c0152c..b73a300d2e 100644
--- a/packages/models/src/videos/channel/video-channel.model.ts
+++ b/packages/models/src/videos/channel/video-channel.model.ts
@@ -10,6 +10,7 @@ export interface VideoChannel extends Actor {
displayName: string
description: string
support: string
+ publicEmail?: string
isLocal: boolean
updatedAt: Date | string
diff --git a/packages/server-commands/src/feeds/feeds-command.ts b/packages/server-commands/src/feeds/feeds-command.ts
index cadecbb327..4ec1470a7e 100644
--- a/packages/server-commands/src/feeds/feeds-command.ts
+++ b/packages/server-commands/src/feeds/feeds-command.ts
@@ -1,5 +1,5 @@
+import { FeedEnclosurePreference, HttpStatusCode } from '@peertube/peertube-models'
import { buildUUID } from '@peertube/peertube-node-utils'
-import { HttpStatusCode } from '@peertube/peertube-models'
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'
type FeedType = 'videos' | 'video-comments' | 'subscriptions'
@@ -37,9 +37,10 @@ export class FeedCommand extends AbstractCommand {
ignoreCache: boolean
channelId?: number
playlistId?: number
+ enclosurePreference?: FeedEnclosurePreference
}
) {
- const { ignoreCache, channelId, playlistId } = options
+ const { ignoreCache, channelId, playlistId, enclosurePreference } = options
const path = `/feeds/podcast/videos.xml`
const query: { [id: string]: string } = {}
@@ -47,6 +48,7 @@ export class FeedCommand extends AbstractCommand {
if (ignoreCache) query.v = buildUUID()
if (channelId) query.videoChannelId = channelId + ''
if (playlistId) query.playlistId = playlistId + ''
+ if (enclosurePreference) query.enclosurePreference = enclosurePreference
return this.getRequestText({
...options,
diff --git a/packages/tests/src/api/users/user-import.ts b/packages/tests/src/api/users/user-import.ts
index ff0a020bbb..d9f06b4004 100644
--- a/packages/tests/src/api/users/user-import.ts
+++ b/packages/tests/src/api/users/user-import.ts
@@ -209,6 +209,7 @@ function runTest (withObjectStorage: boolean) {
expect(importedSecond.displayName).to.equal('noah display name')
expect(importedSecond.description).to.equal('noah description')
expect(importedSecond.support).to.equal('noah support')
+ expect(importedSecond.publicEmail).to.equal('[email protected]')
const playerSettingSecond = await remoteServer.playerSettings.getForChannel({
channelHandle: 'noah_second_channel',
diff --git a/packages/tests/src/api/videos/video-channels.ts b/packages/tests/src/api/videos/video-channels.ts
index 891465d8aa..01364b8c2f 100644
--- a/packages/tests/src/api/videos/video-channels.ts
+++ b/packages/tests/src/api/videos/video-channels.ts
@@ -193,7 +193,8 @@ describe('Test video channels', function () {
const videoChannelAttributes = {
displayName: 'video channel updated',
description: 'video channel description updated',
- support: 'support updated'
+ support: 'support updated',
+ publicEmail: '[email protected]'
}
await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
@@ -213,6 +214,7 @@ describe('Test video channels', function () {
expect(body.data[0].displayName).to.equal('video channel updated')
expect(body.data[0].description).to.equal('video channel description updated')
expect(body.data[0].support).to.equal('support updated')
+ expect(body.data[0].publicEmail).to.equal('[email protected]')
}
})
diff --git a/packages/tests/src/feeds/feeds.ts b/packages/tests/src/feeds/feeds.ts
index ea43bacdb8..f4dfebe308 100644
--- a/packages/tests/src/feeds/feeds.ts
+++ b/packages/tests/src/feeds/feeds.ts
@@ -16,7 +16,7 @@ import {
stopFfmpeg,
waitJobs
} from '@peertube/peertube-server-commands'
-import { expectStartWith, testImageSize } from '@tests/shared/checks.js'
+import { expectEndWith, expectStartWith, testImageSize } from '@tests/shared/checks.js'
import * as chai from 'chai'
import chaiJSONSChema from 'chai-json-schema'
import chaiXML from 'chai-xml'
@@ -29,6 +29,13 @@ chai.config.includeStack = true
const expect = chai.expect
+function parseXMLFeed (rss: string) {
+ expect(XMLValidator.validate(rss)).to.be.true
+
+ const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
+ return parser.parse(rss)
+}
+
describe('Test syndication feeds', () => {
let servers: PeerTubeServer[] = []
let serverHLSOnly: PeerTubeServer
@@ -183,11 +190,9 @@ describe('Test syndication feeds', () => {
it('Should contain a valid podcast enclosures', async function () {
// Since podcast feeds should only work on the server they originate on,
// only test the first server where the videos reside
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
+ )
const itemGuid = xmlDoc.rss.channel.item.guid
expect(itemGuid).to.exist
@@ -215,11 +220,9 @@ describe('Test syndication feeds', () => {
})
it('Should contain a valid podcast enclosures with HLS only', async function () {
- const rss = await serverHLSOnly.feed.getPodcastXML({ ignoreCache: false, channelId: serverHLSOnly.store.channel.id })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await serverHLSOnly.feed.getPodcastXML({ ignoreCache: false, channelId: serverHLSOnly.store.channel.id })
+ )
const itemGuid = xmlDoc.rss.channel.item.guid
expect(itemGuid).to.exist
@@ -260,11 +263,9 @@ describe('Test syndication feeds', () => {
})
it('Should contain a valid podcast:socialInteract', async function () {
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
+ )
const item = xmlDoc.rss.channel.item
const socialInteract = item['podcast:socialInteract']
@@ -275,11 +276,9 @@ describe('Test syndication feeds', () => {
})
it('Should contain a valid support custom tags for plugins', async function () {
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: userChannelId })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: userChannelId })
+ )
const fooTag = xmlDoc.rss.channel.fooTag
expect(fooTag).to.exist
@@ -323,11 +322,9 @@ describe('Test syndication feeds', () => {
const ffmpeg = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveId, copyCodecs: true, fixtureName: 'video_short.mp4' })
await servers[0].live.waitUntilPublished({ videoId: liveId })
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
+ )
const liveItem = xmlDoc.rss.channel['podcast:liveItem']
expect(liveItem.title).to.equal('live-0')
expect(liveItem.guid['@_isPermaLink']).to.equal(true)
@@ -351,11 +348,9 @@ describe('Test syndication feeds', () => {
})
it('Should have valid itunes metadata', async function () {
- const rss = await serverHLSOnly.feed.getPodcastXML({ ignoreCache: false, channelId: serverHLSOnly.store.channel.id })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await serverHLSOnly.feed.getPodcastXML({ ignoreCache: false, channelId: serverHLSOnly.store.channel.id })
+ )
const channel = xmlDoc.rss.channel
@@ -388,9 +383,9 @@ describe('Test syndication feeds', () => {
})
it('Should have p20url podcast txt attribute with local podcast feed', async function () {
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: servers[0].store.channel.id })
+ )
const podcastUrlEl = xmlDoc.rss.channel['podcast:txt']
expect(podcastUrlEl).to.exist
@@ -432,17 +427,15 @@ describe('Test syndication feeds', () => {
let xmlDoc: any
it('Should contain a valid podcast enclosures', async function () {
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, playlistId: podcastPlaylistId })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- xmlDoc = parser.parse(rss)
+ xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, playlistId: podcastPlaylistId })
+ )
const channel = xmlDoc.rss.channel
expect(channel.title).to.equal('Podcast playlist')
})
- it('Should not contain private video', async function () {
+ it('Should not contain private video', function () {
const items = Array.isArray(xmlDoc.rss.channel.item)
? xmlDoc.rss.channel.item
: [ xmlDoc.rss.channel.item ]
@@ -456,8 +449,7 @@ describe('Test syndication feeds', () => {
await servers[0].playlists.addElement({ playlistId: podcastPlaylistId, attributes: { videoId: unlisted.id } })
const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, playlistId: podcastPlaylistId })
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(rss)
const items = Array.isArray(xmlDoc.rss.channel.item)
? xmlDoc.rss.channel.item
@@ -518,11 +510,9 @@ describe('Test syndication feeds', () => {
await servers[0].playlists.addElement({ playlistId: podcastPlaylistId, attributes: { videoId: newVideo.id } })
const getItem = async () => {
- const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, playlistId: podcastPlaylistId })
- expect(XMLValidator.validate(rss)).to.be.true
-
- const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
- const xmlDoc = parser.parse(rss)
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({ ignoreCache: false, playlistId: podcastPlaylistId })
+ )
const items = Array.isArray(xmlDoc.rss.channel.item)
? xmlDoc.rss.channel.item
@@ -543,6 +533,105 @@ describe('Test syndication feeds', () => {
await waitJobs(servers)
})
})
+
+ describe('Enclosure preference', function () {
+ let channelId: number
+
+ before(async function () {
+ this.timeout(120000)
+
+ const { id } = await servers[0].channels.create({
+ attributes: {
+ name: 'enclosure-preference'
+ }
+ })
+ channelId = id
+
+ await servers[0].config.enableTranscoding({ webVideo: true, hls: true, with0p: true, resolutions: 'max' })
+
+ await servers[0].videos.quickUpload({ name: 'video for enclosure preference', channelId })
+
+ await waitJobs(servers)
+ })
+
+ it('Should filter by enclosurePreference "video"', async function () {
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({
+ ignoreCache: false,
+ channelId,
+ enclosurePreference: 'video'
+ })
+ )
+
+ const enclosure = xmlDoc.rss.channel.item.enclosure
+ expectEndWith(enclosure['@_url'], '-720.mp4')
+ expect(enclosure['@_type']).to.equal('video/mp4')
+ })
+
+ it('Should filter by enclosurePreference "audio"', async function () {
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({
+ ignoreCache: false,
+ channelId,
+ enclosurePreference: 'audio'
+ })
+ )
+
+ const enclosure = xmlDoc.rss.channel.item.enclosure
+ expectEndWith(enclosure['@_url'], '-0.mp4')
+ expect(enclosure['@_type']).to.equal('audio/x-m4a')
+ })
+
+ it('Should filter by enclosurePreference "m3u8"', async function () {
+ const xmlDoc = parseXMLFeed(
+ await servers[0].feed.getPodcastXML({
+ ignoreCache: false,
+ channelId,
+ enclosurePreference: 'm3u8'
+ })
+ )
+
+ const enclosure = xmlDoc.rss.channel.item.enclosure
+ expectEndWith(enclosure['@_url'], '-master.m3u8')
+ expect(enclosure['@_type']).to.equal('application/x-mpegURL')
+ })
+
+ after(async function () {
+ await servers[0].channels.delete({ channelName: 'enclosure-preference' })
+
+ await waitJobs(servers)
+ })
+ })
+
+ describe('Podcast email', function () {
+ function getPodcastXMLs () {
+ return Promise.all([
+ servers[0].feed.getPodcastXML({ ignoreCache: true, channelId: servers[0].store.channel.id }),
+ servers[0].feed.getPodcastXML({ ignoreCache: true, playlistId: podcastPlaylistId })
+ ])
+ }
+
+ it('Should not have the public email in the podcast feed', async function () {
+ for (const xmlDoc of await getPodcastXMLs()) {
+ const channel = parseXMLFeed(xmlDoc).rss.channel
+
+ expect(channel['itunes:owner']['itunes:email']).to.be.empty
+ }
+ })
+
+ it('Should set the channel public email', async function () {
+ await servers[0].channels.update({
+ channelName: servers[0].store.channel.name,
+ attributes: { publicEmail: '[email protected]' }
+ })
+
+ for (const xmlDoc of await getPodcastXMLs()) {
+ const channel = parseXMLFeed(xmlDoc).rss.channel
+
+ expect(channel['itunes:owner']['itunes:email']).to.equal('[email protected]')
+ }
+ })
+ })
})
describe('JSON feed', function () {
diff --git a/packages/tests/src/shared/import-export.ts b/packages/tests/src/shared/import-export.ts
index 0bc701791f..95da73a895 100644
--- a/packages/tests/src/shared/import-export.ts
+++ b/packages/tests/src/shared/import-export.ts
@@ -203,6 +203,8 @@ export async function prepareImportExportTests (options: {
}
})
+ await server.channels.update({ token: noahToken, channelName: 'noah_second_channel', attributes: { publicEmail: '[email protected]' } })
+
await server.channels.updateImage({
channelName: 'noah_second_channel',
fixture: 'banner.jpg',
diff --git a/server/core/controllers/api/users/me.ts b/server/core/controllers/api/users/me.ts
index 7d6c4716c9..8a1030cc14 100644
--- a/server/core/controllers/api/users/me.ts
+++ b/server/core/controllers/api/users/me.ts
@@ -307,7 +307,6 @@ async function updateMe (req: express.Request, res: express.Response) {
'noInstanceConfigWarningModal',
'noAccountSetupWarningModal',
'noWelcomeModal',
- 'emailPublic',
'p2pEnabled'
]
diff --git a/server/core/controllers/api/video-channels/index.ts b/server/core/controllers/api/video-channels/index.ts
index d67bbb8e0b..22a1e9bae5 100644
--- a/server/core/controllers/api/video-channels/index.ts
+++ b/server/core/controllers/api/video-channels/index.ts
@@ -233,19 +233,20 @@ async function createVideoChannel (req: express.Request, res: express.Response)
async function updateVideoChannel (req: express.Request, res: express.Response) {
const videoChannelInstance = res.locals.videoChannel
const oldVideoChannelAuditKeys = new VideoChannelAuditView(videoChannelInstance.toFormattedJSON())
- const videoChannelInfoToUpdate = req.body as VideoChannelUpdate
+ const body = req.body as VideoChannelUpdate
let doBulkVideoUpdate = false
try {
await sequelizeTypescript.transaction(async t => {
- if (videoChannelInfoToUpdate.displayName !== undefined) videoChannelInstance.name = videoChannelInfoToUpdate.displayName
- if (videoChannelInfoToUpdate.description !== undefined) videoChannelInstance.description = videoChannelInfoToUpdate.description
+ if (body.displayName !== undefined) videoChannelInstance.name = body.displayName
+ if (body.description !== undefined) videoChannelInstance.description = body.description
+ if (body.publicEmail !== undefined) videoChannelInstance.publicEmail = body.publicEmail
- if (videoChannelInfoToUpdate.support !== undefined) {
+ if (body.support !== undefined) {
const oldSupportField = videoChannelInstance.support
- videoChannelInstance.support = videoChannelInfoToUpdate.support
+ videoChannelInstance.support = body.support
- if (videoChannelInfoToUpdate.bulkVideosSupportUpdate === true && oldSupportField !== videoChannelInfoToUpdate.support) {
+ if (body.bulkVideosSupportUpdate === true && oldSupportField !== body.support) {
doBulkVideoUpdate = true
await VideoModel.bulkUpdateSupportField(videoChannelInstance, t)
}
diff --git a/server/core/controllers/feeds/shared/common-feed-utils.ts b/server/core/controllers/feeds/shared/common-feed-utils.ts
index 46de6329fd..81d6682253 100644
--- a/server/core/controllers/feeds/shared/common-feed-utils.ts
+++ b/server/core/controllers/feeds/shared/common-feed-utils.ts
@@ -8,12 +8,10 @@ import { WEBSERVER } from '@server/initializers/constants.js'
import { regenerateActorImageFiles } from '@server/lib/local-actor.js'
import { ServerConfigManager } from '@server/lib/server-config-manager.js'
import { getServerActor } from '@server/models/application/application.js'
-import { UserModel } from '@server/models/user/user.js'
import {
MAccountDefault,
MChannelBannerAccountDefault,
MChannelDefault,
- MUser,
MVideo,
MVideoPlaylistFull
} from '@server/types/models/index.js'
@@ -133,7 +131,6 @@ export async function buildFeedMetadata (options: {
let email: string
let link: string
let ownerLink: string
- let user: MUser
if (videoPlaylist) {
name = videoPlaylist.name
@@ -151,8 +148,6 @@ export async function buildFeedMetadata (options: {
if (channel.Actor.hasImage(ActorImageType.AVATAR)) {
ownerImageUrl = await getOrGenerateActorImageUrl(channel)
}
-
- user = await UserModel.loadById(videoPlaylist.OwnerAccount.userId)
} else if (videoChannel) {
name = videoChannel.getDisplayName()
description = videoChannel.description
@@ -163,8 +158,6 @@ export async function buildFeedMetadata (options: {
imageUrl = await getOrGenerateActorImageUrl(videoChannel)
ownerImageUrl = imageUrl
}
-
- user = await UserModel.loadById(videoChannel.Account.userId)
} else if (account) {
name = account.getDisplayName()
description = account.description
@@ -175,8 +168,6 @@ export async function buildFeedMetadata (options: {
imageUrl = await getOrGenerateActorImageUrl(account)
ownerImageUrl = imageUrl
}
-
- user = await UserModel.loadById(account.userId)
} else if (video) {
name = video.name
description = video.description
@@ -187,10 +178,12 @@ export async function buildFeedMetadata (options: {
link = WEBSERVER.URL
}
- // If the user is local, has a verified email address, and allows it to be publicly displayed
- // Return it so the owner can prove ownership of their feed
- if (user && !user.pluginAuth && user.emailVerified && user.emailPublic) {
- email = user.email
+ // If the video channel has a public email set, use it
+ // So the owner can prove ownership of their feed
+ if (videoChannel?.publicEmail) {
+ email = videoChannel.publicEmail
+ } else if (videoPlaylist?.VideoChannel?.publicEmail) {
+ email = videoPlaylist.VideoChannel.publicEmail
}
return { name, description, imageUrl, ownerImageUrl, email, link, ownerLink }
diff --git a/server/core/controllers/feeds/video-podcast-feeds.ts b/server/core/controllers/feeds/video-podcast-feeds.ts
index 5531231eeb..8ab3afc48a 100644
--- a/server/core/controllers/feeds/video-podcast-feeds.ts
+++ b/server/core/controllers/feeds/video-podcast-feeds.ts
@@ -1,7 +1,7 @@
import { Feed } from '@peertube/feed'
import { CustomTag, CustomXMLNS, LiveItemStatus } from '@peertube/feed/lib/typings/index.js'
import { buildDownloadFilesUrl, getResolutionLabel, sortObjectComparator } from '@peertube/peertube-core-utils'
-import { ActorImageType, VideoFile, VideoInclude, VideoResolution, VideoState } from '@peertube/peertube-models'
+import { ActorImageType, FeedEnclosurePreference, VideoFile, VideoInclude, VideoResolution, VideoState } from '@peertube/peertube-models'
import { buildUUIDv5FromURL } from '@peertube/peertube-node-utils'
import { buildNSFWFilters } from '@server/helpers/express-utils.js'
import { logger } from '@server/helpers/logger.js'
@@ -165,7 +165,7 @@ async function generateChannelPodcastFeed (req: express.Request, res: express.Re
customTags
})
- await addVideosToPodcastFeed(feed, data)
+ await addVideosToPodcastFeed(feed, data, req.query.enclosurePreference)
// Now the feed generation is done, let's send it!
return res.send(feed.podcast()).end()
@@ -236,7 +236,7 @@ async function generatePlaylistPodcastFeed (req: express.Request, res: express.R
customTags
})
- await addVideosToPodcastFeed(feed, data)
+ await addVideosToPodcastFeed(feed, data, req.query.enclosurePreference)
return res.send(feed.podcast()).end()
}
@@ -308,12 +308,12 @@ async function generatePodcastItem (options: {
}
}
-async function addVideosToPodcastFeed (feed: Feed, videos: VideoModel[]) {
+async function addVideosToPodcastFeed (feed: Feed, videos: VideoModel[], enclosurePreference?: FeedEnclosurePreference) {
const captionsGroup = await VideoCaptionModel.listCaptionsOfMultipleVideos(videos.map(v => v.id))
for (const video of videos) {
if (!video.isLive) {
- await addVODPodcastItem({ feed, video, captionsGroup })
+ await addVODPodcastItem({ feed, video, captionsGroup, enclosurePreference })
} else if (video.isLive && video.state !== VideoState.LIVE_ENDED) {
await addLivePodcastItem({ feed, video })
}
@@ -324,18 +324,31 @@ async function addVODPodcastItem (options: {
feed: Feed
video: VideoModel
captionsGroup: { [id: number]: MVideoCaptionVideo[] }
+ enclosurePreference?: FeedEnclosurePreference
}) {
- const { feed, video, captionsGroup } = options
+ const { feed, video, captionsGroup, enclosurePreference } = options
+
+ const resolutionSortOrder = enclosurePreference === 'video'
+ ? 'desc' as const
+ : 'asc'
const webVideos = video.getFormattedWebVideoFilesJSON(true)
+ .filter(f => {
+ if (enclosurePreference === 'audio' && f.resolution.id !== VideoResolution.H_NOVIDEO) return false
+ if (enclosurePreference === 'video' && f.resolution.id === VideoResolution.H_NOVIDEO) return false
+ if (enclosurePreference === 'm3u8') return false
+
+ return true
+ })
.map(f => buildVODWebVideoFile(video, f))
- .sort(sortObjectComparator('bitrate', 'asc'))
+ .sort(sortObjectComparator('resolution', resolutionSortOrder))
- const streamingPlaylistFiles = buildVODStreamingPlaylistsIfMissingWebVideoFile(video)
+ const streamingPlaylistFiles = buildVODStreamingPlaylistsIfMissingWebVideoFile({ video, enclosurePreference, resolutionSortOrder })
// Order matters here, the first media URI will be the "default"
// So web videos are default if enabled
- const media = [ ...webVideos, ...streamingPlaylistFiles ]
+ const media: PodcastMedia[] = [ ...webVideos, ...streamingPlaylistFiles ]
+ if (media.length === 0) return
const videoCaptions = buildVODCaptions(captionsGroup[video.id])
const item = await generatePodcastItem({ video, liveItem: false, media })
@@ -355,6 +368,7 @@ async function addLivePodcastItem (options: {
case VideoState.WAITING_FOR_LIVE:
status = LiveItemStatus.pending
break
+
case VideoState.PUBLISHED:
status = LiveItemStatus.live
break
@@ -387,16 +401,38 @@ function buildVODWebVideoFile (video: MVideo, videoFile: VideoFile) {
}
}
-function buildVODStreamingPlaylistsIfMissingWebVideoFile (video: MVideoFull) {
+function buildVODStreamingPlaylistsIfMissingWebVideoFile (options: {
+ video: MVideoFull
+ resolutionSortOrder: 'asc' | 'desc'
+ enclosurePreference?: FeedEnclosurePreference
+}) {
+ const { video, enclosurePreference, resolutionSortOrder } = options
+
const hls = video.getHLSPlaylist()
if (!hls) return []
+ const m3u8 = {
+ type: 'application/x-mpegURL',
+ title: 'HLS',
+ sources: [
+ { uri: hls.getMasterPlaylistUrl(video) }
+ ],
+ language: video.language
+ }
+
+ if (enclosurePreference === 'm3u8') return [ m3u8 ]
+
const { separatedAudioFile } = video.getMaxQualityAudioAndVideoFiles()
- return [
+ const files = [
...hls.VideoFiles
- .filter(videoFile => !video.VideoFiles.some(f => f.fps === videoFile.fps && f.resolution === videoFile.resolution))
- .sort(sortObjectComparator('resolution', 'asc'))
+ .filter(videoFile => {
+ if (enclosurePreference === 'audio' && videoFile.hasVideo()) return false
+ if (enclosurePreference === 'video' && !videoFile.hasVideo()) return false
+
+ return !video.VideoFiles.some(f => f.fps === videoFile.fps && f.resolution === videoFile.resolution)
+ })
+ .sort(sortObjectComparator('resolution', resolutionSortOrder))
.map(videoFile => {
const files = [ videoFile ]
@@ -422,17 +458,13 @@ function buildVODStreamingPlaylistsIfMissingWebVideoFile (video: MVideoFull) {
}
]
}
- }),
-
- {
- type: 'application/x-mpegURL',
- title: 'HLS',
- sources: [
- { uri: hls.getMasterPlaylistUrl(video) }
- ],
- language: video.language
- }
+ })
]
+
+ // We don't return m3u8 if we don't have available files
+ if (files.length === 0) return []
+
+ return [ ...files, m3u8 ]
}
function buildLiveStreamingPlaylists (video: MVideoFull) {
diff --git a/server/core/helpers/activity-pub-utils.ts b/server/core/helpers/activity-pub-utils.ts
index ed821dc43c..08fcc85f1a 100644
--- a/server/core/helpers/activity-pub-utils.ts
+++ b/server/core/helpers/activity-pub-utils.ts
@@ -259,7 +259,9 @@ const contextStore: { [id in ContextType]: (string | { [id: string]: string })[]
toot: 'http://joinmastodon.org/ns#',
indexable: 'toot:indexable',
- discoverable: 'toot:discoverable'
+ discoverable: 'toot:discoverable',
+
+ email: 'sc:email'
}),
WatchAction: buildContext({
diff --git a/server/core/helpers/custom-validators/activitypub/actor.ts b/server/core/helpers/custom-validators/activitypub/actor.ts
index 24a0d403ec..175f399221 100644
--- a/server/core/helpers/custom-validators/activitypub/actor.ts
+++ b/server/core/helpers/custom-validators/activitypub/actor.ts
@@ -107,6 +107,7 @@ function normalizeActor (actor: ActivityPubActor) {
setValidUrls(actor)
setValidAttributedTo(actor)
setValidDescription(actor)
+ setValidEmail(actor)
if (!isDateValid(actor.published)) actor.published = undefined
@@ -123,6 +124,11 @@ function setValidDescription (actor: ActivityPubActor) {
if (!actor.summary) actor.summary = null
}
+function setValidEmail (actor: ActivityPubActor) {
+ if (!actor.email) actor.email = null
+ else if (!validator.default.isEmail(actor.email)) actor.email = null
+}
+
function setValidUrls (actor: any) {
if (!actor.url) {
actor.url = []
diff --git a/server/core/helpers/custom-validators/users.ts b/server/core/helpers/custom-validators/users.ts
index ea9a5f7dfb..37160457f2 100644
--- a/server/core/helpers/custom-validators/users.ts
+++ b/server/core/helpers/custom-validators/users.ts
@@ -91,10 +91,6 @@ export function isUserAutoPlayNextVideoPlaylistValid (value: any) {
return isBooleanValid(value)
}
-export function isUserEmailPublicValid (value: any) {
- return isBooleanValid(value)
-}
-
export function isUserNoModal (value: any) {
return isBooleanValid(value)
}
diff --git a/server/core/helpers/custom-validators/video-channels.ts b/server/core/helpers/custom-validators/video-channels.ts
index 2ea3afd2db..bd8aa6dfb1 100644
--- a/server/core/helpers/custom-validators/video-channels.ts
+++ b/server/core/helpers/custom-validators/video-channels.ts
@@ -5,28 +5,25 @@ import { isUserUsernameValid } from './users.js'
const VIDEO_CHANNELS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_CHANNELS
-function isVideoChannelUsernameValid (value: string) {
+export function isVideoChannelUsernameValid (value: string) {
// Use the same constraints than user username
return isUserUsernameValid(value)
}
-function isVideoChannelDescriptionValid (value: string) {
+export function isVideoChannelDescriptionValid (value: string) {
return value === null || validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.DESCRIPTION)
}
-function isVideoChannelDisplayNameValid (value: string) {
+export function isVideoChannelDisplayNameValid (value: string) {
return exists(value) && validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.NAME)
}
-function isVideoChannelSupportValid (value: string) {
+export function isVideoChannelSupportValid (value: string) {
return value === null || (exists(value) && validator.default.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
}
-// ---------------------------------------------------------------------------
-
-export {
- isVideoChannelUsernameValid,
- isVideoChannelDescriptionValid,
- isVideoChannelDisplayNameValid,
- isVideoChannelSupportValid
+export function isVideoChannelPublicEmailValid (value: string) {
+ return value === null || validator.default.isEmail(value)
}
+
+
diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.ts
index ca98f25633..bbbcbfda27 100644
--- a/server/core/initializers/constants.ts
+++ b/server/core/initializers/constants.ts
@@ -62,7 +62,7 @@ import { CONFIG, registerConfigChangedHandler } from './config.js'
// ---------------------------------------------------------------------------
-export const LAST_MIGRATION_VERSION = 1060
+export const LAST_MIGRATION_VERSION = 1065
// ---------------------------------------------------------------------------
diff --git a/server/core/initializers/migrations/1065-add-video-channel-public-email.ts b/server/core/initializers/migrations/1065-add-video-channel-public-email.ts
new file mode 100644
index 0000000000..0ea9533755
--- /dev/null
+++ b/server/core/initializers/migrations/1065-add-video-channel-public-email.ts
@@ -0,0 +1,34 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction
+ queryInterface: Sequelize.QueryInterface
+ sequelize: Sequelize.Sequelize
+}): Promise<void> {
+ await utils.queryInterface.addColumn('videoChannel', 'publicEmail', {
+ type: Sequelize.STRING(400),
+ allowNull: true,
+ defaultValue: null
+ }, { transaction: utils.transaction })
+
+ // Fill publicEmail using associated user email if emailPublic is true
+ await utils.sequelize.query(
+ `UPDATE "videoChannel" SET "publicEmail" = "user"."email"
+ FROM "account"
+ INNER JOIN "user" ON "account"."userId" = "user"."id"
+ WHERE "videoChannel"."accountId" = "account"."id"
+ AND "user"."emailPublic" = true`,
+ { transaction: utils.transaction }
+ )
+
+ await utils.queryInterface.removeColumn('user', 'emailPublic', { transaction: utils.transaction })
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export {
+ down,
+ up
+}
diff --git a/server/core/lib/activitypub/actors/shared/creator.ts b/server/core/lib/activitypub/actors/shared/creator.ts
index 1a1e9de94c..1efb710f5c 100644
--- a/server/core/lib/activitypub/actors/shared/creator.ts
+++ b/server/core/lib/activitypub/actors/shared/creator.ts
@@ -130,6 +130,7 @@ export class APActorCreator {
name: getActorDisplayNameFromObject(this.actorObject),
description: this.actorObject.summary,
support: this.actorObject.support,
+ publicEmail: this.actorObject.email,
accountId: this.ownerActor.Account.id
}, { transaction: t })
diff --git a/server/core/lib/activitypub/actors/updater.ts b/server/core/lib/activitypub/actors/updater.ts
index c9cdc7f401..c682d81c8f 100644
--- a/server/core/lib/activitypub/actors/updater.ts
+++ b/server/core/lib/activitypub/actors/updater.ts
@@ -54,6 +54,7 @@ export class APActorUpdater {
channel.accountId = owner.Account.id
channel.support = this.actorObject.support
+ channel.publicEmail = this.actorObject.email
if (typeof this.actorObject.playerSettings === 'string') {
await upsertAPPlayerSettings({
diff --git a/server/core/lib/rss.ts b/server/core/lib/rss.ts
index 8655919ff0..03e0620472 100644
--- a/server/core/lib/rss.ts
+++ b/server/core/lib/rss.ts
@@ -25,7 +25,9 @@ export function getChannelRSSFeeds (channel: MChannel, req: express.Request) {
titles: {
instanceVideosFeed: req.t('{instanceName} - Videos feed', { instanceName: CONFIG.INSTANCE.NAME }),
channelVideosFeed: req.t('{name} - Videos feed', { name: channel.getDisplayName() }),
- channelPodcastFeed: req.t('{name} - Podcast feed', { name: channel.getDisplayName() })
+ channelPodcastFeed: req.t('{name} - Podcast feed', { name: channel.getDisplayName() }),
+ channelPodcastAudioFeed: req.t('{name} - Apple Podcast audio feed', { name: channel.getDisplayName() }),
+ channelPodcastVideoFeed: req.t('{name} - Apple Podcast video feed', { name: channel.getDisplayName() })
}
})
}
@@ -47,7 +49,9 @@ export function getPlaylistRSSFeeds (playlist: { displayName: string, id: number
playlist,
titles: {
instanceVideosFeed: req.t('{instanceName} - Videos feed', { instanceName: CONFIG.INSTANCE.NAME }),
- playlistPodcastFeed: req.t('{name} - Podcast feed', { name: playlist.displayName })
+ playlistPodcastFeed: req.t('{name} - Podcast feed', { name: playlist.displayName }),
+ playlistPodcastAudioFeed: req.t('{name} - Apple Podcast audio feed', { name: playlist.displayName }),
+ playlistPodcastVideoFeed: req.t('{name} - Apple Podcast video feed', { name: playlist.displayName })
}
})
}
diff --git a/server/core/lib/server-config-manager.ts b/server/core/lib/server-config-manager.ts
index bc8a21615b..df41aef3d4 100644
--- a/server/core/lib/server-config-manager.ts
+++ b/server/core/lib/server-config-manager.ts
@@ -213,14 +213,17 @@ class ServerConfigManager {
enabled: CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.REMOTE_RUNNERS.ENABLED
},
hls: {
- enabled: CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.HLS.ENABLED
+ enabled: CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.HLS.ENABLED,
+ splitAudioAndVideo: CONFIG.TRANSCODING.HLS.SPLIT_AUDIO_AND_VIDEO
},
web_videos: {
enabled: CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.WEB_VIDEOS.ENABLED
},
enabledResolutions: this.getEnabledResolutions('vod'),
profile: CONFIG.TRANSCODING.PROFILE,
- availableProfiles: VideoTranscodingProfilesManager.Instance.getAvailableProfiles('vod')
+ availableProfiles: VideoTranscodingProfilesManager.Instance.getAvailableProfiles('vod'),
+ alwaysTranscodeOriginalResolution: CONFIG.TRANSCODING.ALWAYS_TRANSCODE_ORIGINAL_RESOLUTION,
+ alwaysTranscodePodcastOptimizedAudio: CONFIG.TRANSCODING.ALWAYS_TRANSCODE_PODCAST_OPTIMIZED_AUDIO
},
live: {
enabled: CONFIG.LIVE.ENABLED,
diff --git a/server/core/lib/user-import-export/exporters/channels-exporter.ts b/server/core/lib/user-import-export/exporters/channels-exporter.ts
index 78854613dc..21621c2128 100644
--- a/server/core/lib/user-import-export/exporters/channels-exporter.ts
+++ b/server/core/lib/user-import-export/exporters/channels-exporter.ts
@@ -58,6 +58,7 @@ export class ChannelsExporter extends ActorExporter<ChannelExportJSON> {
displayName: channel.getDisplayName(),
description: channel.description,
support: channel.support,
+ publicEmail: channel.publicEmail,
playerSettings: this.exportPlayerSettingsJSON(playerSettings),
diff --git a/server/core/lib/user-import-export/exporters/user-settings-exporter.ts b/server/core/lib/user-import-export/exporters/user-settings-exporter.ts
index ff6d2d7021..8fdd14e0b7 100644
--- a/server/core/lib/user-import-export/exporters/user-settings-exporter.ts
+++ b/server/core/lib/user-import-export/exporters/user-settings-exporter.ts
@@ -7,7 +7,6 @@ export class UserSettingsExporter extends AbstractUserExporter<UserSettingsExpor
json: {
email: this.user.email,
- emailPublic: this.user.emailPublic,
nsfwPolicy: this.user.nsfwPolicy,
autoPlayVideo: this.user.autoPlayVideo,
diff --git a/server/core/lib/user-import-export/importers/channels-importer.ts b/server/core/lib/user-import-export/importers/channels-importer.ts
index 98b016f408..40bd978764 100644
--- a/server/core/lib/user-import-export/importers/channels-importer.ts
+++ b/server/core/lib/user-import-export/importers/channels-importer.ts
@@ -4,6 +4,7 @@ import { isPlayerChannelThemeSettingValid } from '@server/helpers/custom-validat
import {
isVideoChannelDescriptionValid,
isVideoChannelDisplayNameValid,
+ isVideoChannelPublicEmailValid,
isVideoChannelSupportValid,
isVideoChannelUsernameValid
} from '@server/helpers/custom-validators/video-channels.js'
@@ -22,7 +23,7 @@ const lTags = loggerTagsFactory('user-import')
type SanitizedObject = Pick<
ChannelExportJSON['channels'][0],
- 'name' | 'displayName' | 'description' | 'support' | 'playerSettings' | 'archiveFiles'
+ 'name' | 'displayName' | 'description' | 'support' | 'publicEmail' | 'playerSettings' | 'archiveFiles'
>
export class ChannelsImporter extends AbstractUserImporter<ChannelExportJSON, ChannelExportJSON['channels'][0], SanitizedObject> {
@@ -36,12 +37,13 @@ export class ChannelsImporter extends AbstractUserImporter<ChannelExportJSON, Ch
if (!isVideoChannelDescriptionValid(channelImportData.description)) channelImportData.description = null
if (!isVideoChannelSupportValid(channelImportData.support)) channelImportData.support = null
+ if (!isVideoChannelPublicEmailValid(channelImportData.publicEmail)) channelImportData.publicEmail = null
if (channelImportData.playerSettings) {
if (!isPlayerChannelThemeSettingValid(channelImportData.playerSettings.theme)) channelImportData.playerSettings.theme = undefined
}
- return pick(channelImportData, [ 'name', 'displayName', 'description', 'support', 'playerSettings', 'archiveFiles' ])
+ return pick(channelImportData, [ 'name', 'displayName', 'description', 'support', 'publicEmail', 'playerSettings', 'archiveFiles' ])
}
protected async importObject (channelImportData: SanitizedObject) {
@@ -52,7 +54,11 @@ export class ChannelsImporter extends AbstractUserImporter<ChannelExportJSON, Ch
logger.info(`Do not import channel ${existingChannel.name} that already exists on this PeerTube instance`, lTags())
} else {
const videoChannelCreated = await sequelizeTypescript.transaction(async t => {
- return createLocalVideoChannelWithoutKeys(pick(channelImportData, [ 'displayName', 'name', 'description', 'support' ]), account, t)
+ return createLocalVideoChannelWithoutKeys(
+ pick(channelImportData, [ 'displayName', 'name', 'description', 'support', 'publicEmail' ]),
+ account,
+ t
+ )
})
await this.importPlayerSettings(videoChannelCreated, channelImportData)
diff --git a/server/core/lib/video-channel.ts b/server/core/lib/video-channel.ts
index 76ebc50e5a..97828db9bc 100644
--- a/server/core/lib/video-channel.ts
+++ b/server/core/lib/video-channel.ts
@@ -12,6 +12,7 @@ export async function createLocalVideoChannelWithoutKeys (body: VideoChannelCrea
name: body.displayName,
description: body.description,
support: body.support,
+ publicEmail: body.publicEmail,
accountId: account.id
}, { transaction: t })
diff --git a/server/core/middlewares/validators/feeds.ts b/server/core/middlewares/validators/feeds.ts
index 2c114d94d6..7a47576d16 100644
--- a/server/core/middlewares/validators/feeds.ts
+++ b/server/core/middlewares/validators/feeds.ts
@@ -10,9 +10,9 @@ import {
doesAccountIdExist,
doesChannelHandleExist,
doesChannelIdExist,
- doesVideoPlaylistExist,
doesUserFeedTokenCorrespond,
- doesVideoExist
+ doesVideoExist,
+ doesVideoPlaylistExist
} from './shared/index.js'
export const feedsFormatValidator = [
@@ -116,6 +116,11 @@ export const videoFeedsPodcastValidator = [
.customSanitizer(toCompleteUUID)
.custom(isIdOrUUIDValid),
+ query('enclosurePreference')
+ .optional()
+ .isIn([ 'video', 'audio', 'm3u8' ])
+ .withMessage('Should have a valid enclosurePreference (video, audio, or m3u8)'),
+
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (areValidationErrors(req, res)) return
diff --git a/server/core/middlewares/validators/users/users.ts b/server/core/middlewares/validators/users/users.ts
index 0d10e8ba22..5401f9774d 100644
--- a/server/core/middlewares/validators/users/users.ts
+++ b/server/core/middlewares/validators/users/users.ts
@@ -16,7 +16,6 @@ import {
isUserBlockedReasonValid,
isUserDescriptionValid,
isUserDisplayNameValid,
- isUserEmailPublicValid,
isUserFeatureInfo,
isUserLanguage,
isUserNoModal,
@@ -232,9 +231,6 @@ export const usersUpdateMeValidator = [
body('password')
.optional()
.custom(isUserPasswordValid),
- body('emailPublic')
- .optional()
- .custom(isUserEmailPublicValid),
body('email')
.optional()
.isEmail(),
diff --git a/server/core/middlewares/validators/videos/video-channels.ts b/server/core/middlewares/validators/videos/video-channels.ts
index 0d959cb617..f256338f4c 100644
--- a/server/core/middlewares/validators/videos/video-channels.ts
+++ b/server/core/middlewares/validators/videos/video-channels.ts
@@ -9,6 +9,7 @@ import { isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/cus
import {
isVideoChannelDescriptionValid,
isVideoChannelDisplayNameValid,
+ isVideoChannelPublicEmailValid,
isVideoChannelSupportValid,
isVideoChannelUsernameValid
} from '../../../helpers/custom-validators/video-channels.js'
@@ -27,6 +28,9 @@ export const videoChannelsAddValidator = [
body('support')
.optional()
.custom(isVideoChannelSupportValid),
+ body('publicEmail')
+ .optional()
+ .custom(isVideoChannelPublicEmailValid),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (areValidationErrors(req, res)) return
@@ -63,6 +67,9 @@ export const videoChannelsUpdateValidator = [
body('support')
.optional()
.custom(isVideoChannelSupportValid),
+ body('publicEmail')
+ .optional()
+ .custom(isVideoChannelPublicEmailValid),
body('bulkVideosSupportUpdate')
.optional()
.custom(isBooleanValid).withMessage('Should have a valid bulkVideosSupportUpdate boolean field'),
diff --git a/server/core/models/user/user.ts b/server/core/models/user/user.ts
index 1331a924bc..cea06f5bac 100644
--- a/server/core/models/user/user.ts
+++ b/server/core/models/user/user.ts
@@ -434,11 +434,6 @@ export class UserModel extends SequelizeModel<UserModel> {
@Column
declare lastLoginDate: Date
- @AllowNull(false)
- @Default(false)
- @Column
- declare emailPublic: boolean
-
@AllowNull(true)
@Default(null)
@Column
@@ -1052,7 +1047,6 @@ export class UserModel extends SequelizeModel<UserModel> {
theme: getThemeOrDefault(this.theme, DEFAULT_INSTANCE_THEME_NAME),
pendingEmail: this.pendingEmail,
- emailPublic: this.emailPublic,
emailVerified: this.emailVerified,
nsfwPolicy: this.nsfwPolicy,
diff --git a/server/core/models/video/sql/video/shared/video-table-attributes.ts b/server/core/models/video/sql/video/shared/video-table-attributes.ts
index 37b654fdbd..406c023cdb 100644
--- a/server/core/models/video/sql/video/shared/video-table-attributes.ts
+++ b/server/core/models/video/sql/video/shared/video-table-attributes.ts
@@ -22,6 +22,7 @@ export class VideoTableAttributes {
if (this.mode === 'get') {
attributeKeys = attributeKeys.concat([
+ 'publicEmail',
'support',
'createdAt',
'updatedAt'
diff --git a/server/core/models/video/video-channel.ts b/server/core/models/video/video-channel.ts
index df4dbdc2f7..675ef08fb0 100644
--- a/server/core/models/video/video-channel.ts
+++ b/server/core/models/video/video-channel.ts
@@ -28,6 +28,7 @@ import {
import {
isVideoChannelDescriptionValid,
isVideoChannelDisplayNameValid,
+ isVideoChannelPublicEmailValid,
isVideoChannelSupportValid
} from '../../helpers/custom-validators/video-channels.js'
import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants.js'
@@ -176,6 +177,12 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
@Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max))
declare support: string
+ @AllowNull(true)
+ @Default(null)
+ @Is('VideoChannelPublicEmail', value => throwIfNotValid(value, isVideoChannelPublicEmailValid, 'publicEmail', true))
+ @Column(DataType.STRING(400))
+ declare publicEmail: string
+
@CreatedAt
declare createdAt: Date
@@ -565,6 +572,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
displayName: this.getDisplayName(),
description: this.description,
support: this.support,
+ publicEmail: this.publicEmail,
isLocal: this.Actor.isLocal(),
updatedAt: this.updatedAt,
@@ -611,6 +619,9 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
summary: this.description,
support: this.support,
postingRestrictedToMods: true,
+
+ email: this.publicEmail,
+
attributedTo: [
this.Account.Actor.url
]
diff --git a/server/core/types/models/video/video-channel.ts b/server/core/types/models/video/video-channel.ts
index 7ee9780ff3..9ba1383b9b 100644
--- a/server/core/types/models/video/video-channel.ts
+++ b/server/core/types/models/video/video-channel.ts
@@ -162,11 +162,11 @@ export type MChannelAccountSummaryFormattable =
export type MChannelFormattable =
& FunctionProperties<MChannel>
- & Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support' | 'accountId'>
+ & Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support' | 'accountId' | 'publicEmail'>
& Use<'Actor', MActorFormattable>
& PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
export type MChannelAP =
- & Pick<MChannel, 'id' | 'name' | 'description' | 'support' | 'getClientUrl'>
+ & Pick<MChannel, 'id' | 'name' | 'description' | 'support' | 'getClientUrl' | 'publicEmail'>
& Use<'Actor', MActorAPChannel>
& Use<'Account', MAccountUrl>
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml
index d2bec48468..5d08ec6d84 100644
--- a/support/doc/api/openapi.yaml
+++ b/support/doc/api/openapi.yaml
@@ -750,9 +750,24 @@ paths:
- name: videoChannelId
in: query
description: 'Limit listing to a specific video channel'
- required: true
+ required: false
+ schema:
+ type: string
+ - name: playlistId
+ in: query
+ description: 'Limit listing to a specific video playlist'
+ required: false
+ schema:
+ type: string
+ - name: enclosurePreference
+ in: query
+ description: 'Filter enclosures by type (video-only or audio-only)'
+ required: false
schema:
type: string
+ enum:
+ - video-only
+ - audio-only
responses:
'200':
description: successful operation
@@ -762,7 +777,7 @@ paths:
type: string
default: 'max-age=900' # 15 min cache
'404':
- description: video channel not found
+ description: video channel or playlist not found
'/api/v1/accounts/{name}':
get:
@@ -12733,9 +12748,6 @@ components:
emailVerified:
type: boolean
description: Has the user confirmed their email address?
- emailPublic:
- type: boolean
- description: Has the user accepted to display the email publicly?
nsfwPolicy:
$ref: '#/components/schemas/NSFWPolicy'
@@ -13198,6 +13210,11 @@ components:
example: Please support our work on https://soutenir.framasoft.org/en/ <3
minLength: 3
maxLength: 1000
+ publicEmail:
+ type: string
+ format: email
+ nullable: true
+ description: Public email visible in podcast RSS feeds
isLocal:
type: boolean
updatedAt:
@@ -13218,6 +13235,11 @@ components:
description: Channel description
support:
description: How to support/fund the channel
+ publicEmail:
+ type: string
+ format: email
+ nullable: true
+ description: Public email visible in podcast RSS feeds
VideoChannelCreate:
allOf: