2021-07-22 04:15:17 -05:00
|
|
|
import { OutgoingHttpHeaders } from 'http'
|
2023-03-31 02:12:21 -05:00
|
|
|
import { Writable } from 'stream'
|
2020-06-23 07:10:17 -05:00
|
|
|
import { RegisterServerAuthExternalOptions } from '@server/types'
|
|
|
|
import {
|
2020-07-24 08:05:51 -05:00
|
|
|
MAbuseMessage,
|
2020-07-28 04:12:16 -05:00
|
|
|
MAbuseReporter,
|
2020-06-23 07:10:17 -05:00
|
|
|
MAccountBlocklist,
|
2021-04-06 10:01:35 -05:00
|
|
|
MActorFollowActorsDefault,
|
2020-06-23 07:10:17 -05:00
|
|
|
MActorUrl,
|
2021-04-06 10:01:35 -05:00
|
|
|
MChannelBannerAccountDefault,
|
2022-08-10 02:53:39 -05:00
|
|
|
MChannelSyncChannel,
|
2023-01-19 02:27:16 -06:00
|
|
|
MRegistration,
|
2020-06-23 07:10:17 -05:00
|
|
|
MStreamingPlaylist,
|
2022-12-20 02:15:49 -06:00
|
|
|
MUserAccountUrl,
|
2020-06-23 07:10:17 -05:00
|
|
|
MVideoChangeOwnershipFull,
|
|
|
|
MVideoFile,
|
2021-06-11 02:57:19 -05:00
|
|
|
MVideoFormattableDetails,
|
2021-06-11 07:09:33 -05:00
|
|
|
MVideoId,
|
2020-06-23 07:10:17 -05:00
|
|
|
MVideoImmutable,
|
2023-03-31 02:12:21 -05:00
|
|
|
MVideoLiveFormattable,
|
2023-06-29 02:48:55 -05:00
|
|
|
MVideoPassword,
|
2020-06-23 07:10:17 -05:00
|
|
|
MVideoPlaylistFull,
|
2021-03-03 08:22:38 -06:00
|
|
|
MVideoPlaylistFullSummary
|
2020-06-23 07:10:17 -05:00
|
|
|
} from '@server/types/models'
|
|
|
|
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
|
|
|
import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
|
|
|
|
import { MVideoImportDefault } from '@server/types/models/video/video-import'
|
|
|
|
import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
|
|
|
|
import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
|
2021-07-16 03:42:24 -05:00
|
|
|
import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
|
2021-05-10 04:13:41 -05:00
|
|
|
import { File as UploadXFile, Metadata } from '@uploadx/core'
|
2020-06-18 06:38:20 -05:00
|
|
|
import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
|
2019-08-15 04:53:26 -05:00
|
|
|
import {
|
|
|
|
MAccountDefault,
|
|
|
|
MActorAccountChannelId,
|
|
|
|
MActorFollowActorsDefaultSubscription,
|
|
|
|
MActorFull,
|
|
|
|
MComment,
|
|
|
|
MCommentOwnerVideoReply,
|
|
|
|
MUserDefault,
|
|
|
|
MVideoBlacklist,
|
|
|
|
MVideoCaptionVideo,
|
|
|
|
MVideoFullLight,
|
|
|
|
MVideoRedundancyVideo,
|
|
|
|
MVideoShareActor,
|
2021-06-11 07:26:37 -05:00
|
|
|
MVideoThumbnail
|
2022-02-11 03:51:33 -06:00
|
|
|
} from './models'
|
2023-04-21 07:55:10 -05:00
|
|
|
import { MRunner, MRunnerJobRunner, MRunnerRegistrationToken } from './models/runners'
|
2022-06-21 08:31:25 -05:00
|
|
|
import { MVideoSource } from './models/video/video-source'
|
2021-06-02 11:15:41 -05:00
|
|
|
|
2019-03-19 04:35:15 -05:00
|
|
|
declare module 'express' {
|
2020-06-18 03:45:25 -05:00
|
|
|
export interface Request {
|
2020-06-17 03:55:40 -05:00
|
|
|
query: any
|
2021-05-10 04:13:41 -05:00
|
|
|
method: HttpMethod
|
2020-06-17 03:55:40 -05:00
|
|
|
}
|
2021-05-10 04:13:41 -05:00
|
|
|
|
|
|
|
// Upload using multer or uploadx middleware
|
|
|
|
export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
|
|
|
|
|
|
|
|
export type UploadFiles = {
|
|
|
|
[fieldname: string]: MulterOrUploadXFile[]
|
|
|
|
} | MulterOrUploadXFile[]
|
|
|
|
|
|
|
|
// Partial object used by some functions to check the file mimetype/extension
|
|
|
|
export type UploadFileForCheck = {
|
|
|
|
originalname: string
|
|
|
|
mimetype: string
|
2022-02-11 03:51:33 -06:00
|
|
|
size: number
|
2021-03-03 08:22:38 -06:00
|
|
|
}
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
export type UploadFilesForCheck = {
|
|
|
|
[fieldname: string]: UploadFileForCheck[]
|
|
|
|
} | UploadFileForCheck[]
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
// Upload file with a duration added by our middleware
|
2022-06-21 08:31:25 -05:00
|
|
|
export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size', 'originalname'> & {
|
2021-05-10 04:13:41 -05:00
|
|
|
duration: number
|
|
|
|
}
|
2020-09-17 02:20:52 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
// Extends Metadata property of UploadX object
|
|
|
|
export type UploadXFileMetadata = Metadata & VideoCreate & {
|
|
|
|
previewfile: Express.Multer.File[]
|
|
|
|
thumbnailfile: Express.Multer.File[]
|
|
|
|
}
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
// Our custom UploadXFile object using our custom metadata
|
|
|
|
export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
|
|
|
|
duration: number
|
|
|
|
path: string
|
|
|
|
filename: string
|
2022-06-21 08:31:25 -05:00
|
|
|
originalname: string
|
2021-05-10 04:13:41 -05:00
|
|
|
}
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-31 18:36:53 -05:00
|
|
|
// Extends Response with added functions and potential variables passed by middlewares
|
2021-05-10 04:13:41 -05:00
|
|
|
interface Response {
|
2021-05-31 18:36:53 -05:00
|
|
|
fail: (options: {
|
|
|
|
message: string
|
2021-06-02 11:15:41 -05:00
|
|
|
|
|
|
|
title?: string
|
|
|
|
status?: number
|
2022-10-19 03:43:53 -05:00
|
|
|
type?: ServerErrorCode | string
|
2021-06-02 11:15:41 -05:00
|
|
|
instance?: string
|
|
|
|
|
|
|
|
data?: PeerTubeProblemDocumentData
|
2023-04-21 07:55:10 -05:00
|
|
|
|
|
|
|
tags?: string[]
|
2021-06-02 11:15:41 -05:00
|
|
|
}) => void
|
2021-05-31 18:36:53 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
locals: {
|
2022-07-05 08:43:21 -05:00
|
|
|
requestStart: number
|
|
|
|
|
Add Podcast RSS feeds (#5487)
* Initial test implementation of Podcast RSS
This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option.
I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort.
* Update to pfeed-podcast 1.2.2
* Initial test implementation of Podcast RSS
This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option.
I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort.
* Update to pfeed-podcast 1.2.2
* Initial test implementation of Podcast RSS
This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option.
I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort.
* Update to pfeed-podcast 1.2.2
* Add correct feed image to RSS channel
* Prefer HLS videos for podcast RSS
Remove video/stream titles, add optional height attribute to podcast RSS
* Prefix podcast RSS images with root server URL
* Add optional video query support to include captions
* Add transcripts & person images to podcast RSS feed
* Prefer webseed/webtorrent files over HLS fragmented mp4s
* Experimentally adding podcast fields to basic config page
* Add validation for new basic config fields
* Don't include "content" in podcast feed, use full description for "description"
* Initial test implementation of Podcast RSS
This is a pretty simple implementation to add support for The Podcast Namespace in RSS -- instead of affecting the existing RSS implementation, this adds a new UI option.
I attempted to retain compatibility with the rest of the RSS feed implementation as much as possible and have created a temporary fork of the "pfeed" library to support this effort.
* Update to pfeed-podcast 1.2.2
* Add correct feed image to RSS channel
* Prefer HLS videos for podcast RSS
Remove video/stream titles, add optional height attribute to podcast RSS
* Prefix podcast RSS images with root server URL
* Add optional video query support to include captions
* Add transcripts & person images to podcast RSS feed
* Prefer webseed/webtorrent files over HLS fragmented mp4s
* Experimentally adding podcast fields to basic config page
* Add validation for new basic config fields
* Don't include "content" in podcast feed, use full description for "description"
* Add medium/socialInteract to podcast RSS feeds. Use HTML for description
* Change base production image to bullseye, install prosody in image
* Add liveItem and trackers to Podcast RSS feeds
Remove height from alternateEnclosure, replaced with title.
* Clear Podcast RSS feed cache when live streams start/end
* Upgrade to Node 16
* Refactor clearCacheRoute to use ApiCache
* Remove unnecessary type hint
* Update dockerfile to node 16, install python-is-python2
* Use new file paths for captions/playlists
* Fix legacy videos in RSS after migration to object storage
* Improve method of identifying non-fragmented mp4s in podcast RSS feeds
* Don't include fragmented MP4s in podcast RSS feeds
* Add experimental support for podcast:categories on the podcast RSS item
* Fix undefined category when no videos exist
Allows for empty feeds to exist (important for feeds that might only go live)
* Add support for podcast:locked -- user has to opt in to show their email
* Use comma for podcast:categories delimiter
* Make cache clearing async
* Fix merge, temporarily test with pfeed-podcast
* Syntax changes
* Add EXT_MIMETYPE constants for captions
* Update & fix tests, fix enclosure mimetypes, remove admin email
* Add test for podacst:socialInteract
* Add filters hooks for podcast customTags
* Remove showdown, updated to pfeed-podcast 6.1.2
* Add 'action:api.live-video.state.updated' hook
* Avoid assigning undefined category to podcast feeds
* Remove nvmrc
* Remove comment
* Remove unused podcast config
* Remove more unused podcast config
* Fix MChannelAccountDefault type hint missed in merge
* Remove extra line
* Re-add newline in config
* Fix lint errors for isEmailPublic
* Fix thumbnails in podcast feeds
* Requested changes based on review
* Provide podcast rss 2.0 only on video channels
* Misc cleanup for a less messy PR
* Lint fixes
* Remove pfeed-podcast
* Add peertube version to new hooks
* Don't use query include, remove TODO
* Remove film medium hack
* Clear podcast rss cache before video/channel update hooks
* Clear podcast rss cache before video uploaded/deleted hooks
* Refactor podcast feed cache clearing
* Set correct person name from video channel
* Styling
* Fix tests
---------
Co-authored-by: Chocobozzz <me@florianbigard.com>
2023-05-22 09:00:05 -05:00
|
|
|
apicacheGroups: string[]
|
|
|
|
|
2021-07-22 04:15:17 -05:00
|
|
|
apicache: {
|
|
|
|
content: string | Buffer
|
|
|
|
write: Writable['write']
|
|
|
|
writeHead: Response['writeHead']
|
|
|
|
end: Response['end']
|
|
|
|
cacheable: boolean
|
|
|
|
headers: OutgoingHttpHeaders
|
|
|
|
}
|
|
|
|
|
2021-06-02 11:15:41 -05:00
|
|
|
docUrl?: string
|
|
|
|
|
2021-06-11 02:57:19 -05:00
|
|
|
videoAPI?: MVideoFormattableDetails
|
2021-05-10 04:13:41 -05:00
|
|
|
videoAll?: MVideoFullLight
|
|
|
|
onlyImmutableVideo?: MVideoImmutable
|
|
|
|
onlyVideo?: MVideoThumbnail
|
2021-06-11 07:09:33 -05:00
|
|
|
videoId?: MVideoId
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2023-03-31 02:12:21 -05:00
|
|
|
videoLive?: MVideoLiveFormattable
|
2022-05-03 04:38:07 -05:00
|
|
|
videoLiveSession?: MVideoLiveSession
|
2019-08-15 04:53:26 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoShare?: MVideoShareActor
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2022-06-21 08:31:25 -05:00
|
|
|
videoSource?: MVideoSource
|
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoFile?: MVideoFile
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoFileResumable?: EnhancedUploadXFile
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoImport?: MVideoImportDefault
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoBlacklist?: MVideoBlacklist
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoCaption?: MVideoCaptionVideo
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
abuse?: MAbuseReporter
|
|
|
|
abuseMessage?: MAbuseMessage
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoStreamingPlaylist?: MStreamingPlaylist
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoChannel?: MChannelBannerAccountDefault
|
2022-08-10 02:53:39 -05:00
|
|
|
videoChannelSync?: MChannelSyncChannel
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoPlaylistFull?: MVideoPlaylistFull
|
|
|
|
videoPlaylistSummary?: MVideoPlaylistFullSummary
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoPlaylistElement?: MVideoPlaylistElement
|
|
|
|
videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
accountVideoRate?: MAccountVideoRateAccountVideo
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
videoCommentFull?: MCommentOwnerVideoReply
|
|
|
|
videoCommentThread?: MComment
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2023-06-29 02:48:55 -05:00
|
|
|
videoPassword?: MVideoPassword
|
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
follow?: MActorFollowActorsDefault
|
|
|
|
subscription?: MActorFollowActorsDefaultSubscription
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
nextOwner?: MAccountDefault
|
|
|
|
videoChangeOwnership?: MVideoChangeOwnershipFull
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
account?: MAccountDefault
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
actorUrl?: MActorUrl
|
|
|
|
actorFull?: MActorFull
|
|
|
|
|
|
|
|
user?: MUserDefault
|
2023-01-19 02:27:16 -06:00
|
|
|
userRegistration?: MRegistration
|
2021-05-10 04:13:41 -05:00
|
|
|
|
|
|
|
server?: MServer
|
|
|
|
|
|
|
|
videoRedundancy?: MVideoRedundancyVideo
|
2019-03-19 04:35:15 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
accountBlock?: MAccountBlocklist
|
|
|
|
serverBlock?: MServerBlocklist
|
2019-07-05 06:54:32 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
oauth?: {
|
|
|
|
token: MOAuthTokenUser
|
|
|
|
}
|
2019-07-10 09:59:53 -05:00
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
signature?: {
|
|
|
|
actor: MActorAccountChannelId
|
|
|
|
}
|
2020-04-28 07:49:03 -05:00
|
|
|
|
2022-12-20 02:15:49 -06:00
|
|
|
videoFileToken?: {
|
|
|
|
user: MUserAccountUrl
|
|
|
|
}
|
|
|
|
|
2021-05-10 04:13:41 -05:00
|
|
|
authenticated?: boolean
|
|
|
|
|
|
|
|
registeredPlugin?: RegisteredPlugin
|
|
|
|
|
|
|
|
externalAuth?: RegisterServerAuthExternalOptions
|
|
|
|
|
|
|
|
plugin?: MPlugin
|
2022-03-24 07:36:47 -05:00
|
|
|
|
|
|
|
localViewerFull?: MLocalVideoViewerWithWatchSections
|
2022-08-10 02:53:39 -05:00
|
|
|
|
2023-04-21 07:55:10 -05:00
|
|
|
runner?: MRunner
|
|
|
|
runnerRegistrationToken?: MRunnerRegistrationToken
|
|
|
|
runnerJob?: MRunnerJobRunner
|
2021-05-10 04:13:41 -05:00
|
|
|
}
|
|
|
|
}
|
2019-03-19 04:35:15 -05:00
|
|
|
}
|