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 } from '@shared/core-utils/miscs/http-methods'
26 import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
27 import { File as UploadXFile, Metadata } from '@uploadx/core'
28 import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
31 MActorAccountChannelId,
32 MActorFollowActorsDefaultSubscription,
35 MCommentOwnerVideoReply,
40 MVideoRedundancyVideo,
43 } from '../../types/models'
45 declare module 'express' {
46 export interface Request {
51 // Upload using multer or uploadx middleware
52 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
54 export type UploadFiles = {
55 [fieldname: string]: MulterOrUploadXFile[]
56 } | MulterOrUploadXFile[]
58 // Partial object used by some functions to check the file mimetype/extension
59 export type UploadFileForCheck = {
64 export type UploadFilesForCheck = {
65 [fieldname: string]: UploadFileForCheck[]
66 } | UploadFileForCheck[]
68 // Upload file with a duration added by our middleware
69 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
73 // Extends Metadata property of UploadX object
74 export type UploadXFileMetadata = Metadata & VideoCreate & {
75 previewfile: Express.Multer.File[]
76 thumbnailfile: Express.Multer.File[]
79 // Our custom UploadXFile object using our custom metadata
80 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
82 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
88 // Extends Response with added functions and potential variables passed by middlewares
95 type?: ServerErrorCode
98 data?: PeerTubeProblemDocumentData
104 videoAPI?: MVideoFormattableDetails
105 videoAll?: MVideoFullLight
106 onlyImmutableVideo?: MVideoImmutable
107 onlyVideo?: MVideoThumbnail
110 videoLive?: MVideoLive
112 videoShare?: MVideoShareActor
114 videoFile?: MVideoFile
116 videoFileResumable?: EnhancedUploadXFile
118 videoImport?: MVideoImportDefault
120 videoBlacklist?: MVideoBlacklist
122 videoCaption?: MVideoCaptionVideo
124 abuse?: MAbuseReporter
125 abuseMessage?: MAbuseMessage
127 videoStreamingPlaylist?: MStreamingPlaylist
129 videoChannel?: MChannelBannerAccountDefault
131 videoPlaylistFull?: MVideoPlaylistFull
132 videoPlaylistSummary?: MVideoPlaylistFullSummary
134 videoPlaylistElement?: MVideoPlaylistElement
135 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
137 accountVideoRate?: MAccountVideoRateAccountVideo
139 videoCommentFull?: MCommentOwnerVideoReply
140 videoCommentThread?: MComment
142 follow?: MActorFollowActorsDefault
143 subscription?: MActorFollowActorsDefaultSubscription
145 nextOwner?: MAccountDefault
146 videoChangeOwnership?: MVideoChangeOwnershipFull
148 account?: MAccountDefault
151 actorFull?: MActorFull
157 videoRedundancy?: MVideoRedundancyVideo
159 accountBlock?: MAccountBlocklist
160 serverBlock?: MServerBlocklist
163 token: MOAuthTokenUser
167 actor: MActorAccountChannelId
170 authenticated?: boolean
172 registeredPlugin?: RegisteredPlugin
174 externalAuth?: RegisterServerAuthExternalOptions