2 import { RegisterServerAuthExternalOptions } from '@server/types'
7 MActorFollowActorsDefault,
9 MChannelBannerAccountDefault,
11 MVideoChangeOwnershipFull,
13 MVideoFormattableDetails,
18 MVideoPlaylistFullSummary
19 } from '@server/types/models'
20 import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
21 import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
22 import { MVideoImportDefault } from '@server/types/models/video/video-import'
23 import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
24 import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
25 import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
26 import { File as UploadXFile, Metadata } from '@uploadx/core'
27 import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
30 MActorAccountChannelId,
31 MActorFollowActorsDefaultSubscription,
34 MCommentOwnerVideoReply,
39 MVideoRedundancyVideo,
42 } from '../../types/models'
44 declare module 'express' {
45 export interface Request {
50 // Upload using multer or uploadx middleware
51 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
53 export type UploadFiles = {
54 [fieldname: string]: MulterOrUploadXFile[]
55 } | MulterOrUploadXFile[]
57 // Partial object used by some functions to check the file mimetype/extension
58 export type UploadFileForCheck = {
63 export type UploadFilesForCheck = {
64 [fieldname: string]: UploadFileForCheck[]
65 } | UploadFileForCheck[]
67 // Upload file with a duration added by our middleware
68 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
72 // Extends Metadata property of UploadX object
73 export type UploadXFileMetadata = Metadata & VideoCreate & {
74 previewfile: Express.Multer.File[]
75 thumbnailfile: Express.Multer.File[]
78 // Our custom UploadXFile object using our custom metadata
79 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
81 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
87 // Extends Response with added functions and potential variables passed by middlewares
94 type?: ServerErrorCode
97 data?: PeerTubeProblemDocumentData
103 videoAPI?: MVideoFormattableDetails
104 videoAll?: MVideoFullLight
105 onlyImmutableVideo?: MVideoImmutable
106 onlyVideo?: MVideoThumbnail
109 videoLive?: MVideoLive
111 videoShare?: MVideoShareActor
113 videoFile?: MVideoFile
115 videoFileResumable?: EnhancedUploadXFile
117 videoImport?: MVideoImportDefault
119 videoBlacklist?: MVideoBlacklist
121 videoCaption?: MVideoCaptionVideo
123 abuse?: MAbuseReporter
124 abuseMessage?: MAbuseMessage
126 videoStreamingPlaylist?: MStreamingPlaylist
128 videoChannel?: MChannelBannerAccountDefault
130 videoPlaylistFull?: MVideoPlaylistFull
131 videoPlaylistSummary?: MVideoPlaylistFullSummary
133 videoPlaylistElement?: MVideoPlaylistElement
134 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
136 accountVideoRate?: MAccountVideoRateAccountVideo
138 videoCommentFull?: MCommentOwnerVideoReply
139 videoCommentThread?: MComment
141 follow?: MActorFollowActorsDefault
142 subscription?: MActorFollowActorsDefaultSubscription
144 nextOwner?: MAccountDefault
145 videoChangeOwnership?: MVideoChangeOwnershipFull
147 account?: MAccountDefault
150 actorFull?: MActorFull
156 videoRedundancy?: MVideoRedundancyVideo
158 accountBlock?: MAccountBlocklist
159 serverBlock?: MServerBlocklist
162 token: MOAuthTokenUser
166 actor: MActorAccountChannelId
169 authenticated?: boolean
171 registeredPlugin?: RegisteredPlugin
173 externalAuth?: RegisterServerAuthExternalOptions