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,
41 MVideoRedundancyVideo,
45 } from '../../types/models'
47 declare module 'express' {
48 export interface Request {
53 // Upload using multer or uploadx middleware
54 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
56 export type UploadFiles = {
57 [fieldname: string]: MulterOrUploadXFile[]
58 } | MulterOrUploadXFile[]
60 // Partial object used by some functions to check the file mimetype/extension
61 export type UploadFileForCheck = {
66 export type UploadFilesForCheck = {
67 [fieldname: string]: UploadFileForCheck[]
68 } | UploadFileForCheck[]
70 // Upload file with a duration added by our middleware
71 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
75 // Extends Metadata property of UploadX object
76 export type UploadXFileMetadata = Metadata & VideoCreate & {
77 previewfile: Express.Multer.File[]
78 thumbnailfile: Express.Multer.File[]
81 // Our custom UploadXFile object using our custom metadata
82 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
84 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
90 // Extends Response with added functions and potential variables passed by middlewares
97 type?: ServerErrorCode
100 data?: PeerTubeProblemDocumentData
106 videoAPI?: MVideoFormattableDetails
107 videoAll?: MVideoFullLight
108 onlyImmutableVideo?: MVideoImmutable
109 onlyVideo?: MVideoThumbnail
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