2 import { RegisterServerAuthExternalOptions } from '@server/types'
7 MActorFollowActorsDefault,
9 MChannelBannerAccountDefault,
11 MVideoChangeOwnershipFull,
13 MVideoFormattableDetails,
17 MVideoPlaylistFullSummary
18 } from '@server/types/models'
19 import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
20 import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
21 import { MVideoImportDefault } from '@server/types/models/video/video-import'
22 import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
23 import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
24 import { HttpMethod } from '@shared/core-utils/miscs/http-methods'
25 import { 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,
40 MVideoRedundancyVideo,
44 } from '../../types/models'
46 declare module 'express' {
47 export interface Request {
52 // Upload using multer or uploadx middleware
53 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
55 export type UploadFiles = {
56 [fieldname: string]: MulterOrUploadXFile[]
57 } | MulterOrUploadXFile[]
59 // Partial object used by some functions to check the file mimetype/extension
60 export type UploadFileForCheck = {
65 export type UploadFilesForCheck = {
66 [fieldname: string]: UploadFileForCheck[]
67 } | UploadFileForCheck[]
69 // Upload file with a duration added by our middleware
70 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
74 // Extends Metadata property of UploadX object
75 export type UploadXFileMetadata = Metadata & VideoCreate & {
76 previewfile: Express.Multer.File[]
77 thumbnailfile: Express.Multer.File[]
80 // Our custom UploadXFile object using our custom metadata
81 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
83 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
89 // Extends Response with added functions and potential variables passed by middlewares
96 type?: ServerErrorCode
99 data?: PeerTubeProblemDocumentData
105 videoAPI?: MVideoFormattableDetails
106 videoAll?: MVideoFullLight
107 onlyImmutableVideo?: MVideoImmutable
108 onlyVideo?: MVideoThumbnail
109 onlyVideoWithRights?: MVideoWithRights
110 videoId?: MVideoIdThumbnail
112 videoLive?: MVideoLive
114 videoShare?: MVideoShareActor
116 videoFile?: MVideoFile
118 videoFileResumable?: EnhancedUploadXFile
120 videoImport?: MVideoImportDefault
122 videoBlacklist?: MVideoBlacklist
124 videoCaption?: MVideoCaptionVideo
126 abuse?: MAbuseReporter
127 abuseMessage?: MAbuseMessage
129 videoStreamingPlaylist?: MStreamingPlaylist
131 videoChannel?: MChannelBannerAccountDefault
133 videoPlaylistFull?: MVideoPlaylistFull
134 videoPlaylistSummary?: MVideoPlaylistFullSummary
136 videoPlaylistElement?: MVideoPlaylistElement
137 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
139 accountVideoRate?: MAccountVideoRateAccountVideo
141 videoCommentFull?: MCommentOwnerVideoReply
142 videoCommentThread?: MComment
144 follow?: MActorFollowActorsDefault
145 subscription?: MActorFollowActorsDefaultSubscription
147 nextOwner?: MAccountDefault
148 videoChangeOwnership?: MVideoChangeOwnershipFull
150 account?: MAccountDefault
153 actorFull?: MActorFull
159 videoRedundancy?: MVideoRedundancyVideo
161 accountBlock?: MAccountBlocklist
162 serverBlock?: MServerBlocklist
165 token: MOAuthTokenUser
169 actor: MActorAccountChannelId
172 authenticated?: boolean
174 registeredPlugin?: RegisteredPlugin
176 externalAuth?: RegisterServerAuthExternalOptions