1 import { RegisterServerAuthExternalOptions } from '@server/types'
6 MActorFollowActorsDefault,
8 MChannelBannerAccountDefault,
10 MVideoChangeOwnershipFull,
15 MVideoPlaylistFullSummary
16 } from '@server/types/models'
17 import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
18 import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
19 import { MVideoImportDefault } from '@server/types/models/video/video-import'
20 import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
21 import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
22 import { HttpMethod } from '@shared/core-utils/miscs/http-methods'
23 import { VideoCreate } from '@shared/models'
24 import { File as UploadXFile, Metadata } from '@uploadx/core'
25 import { ProblemDocumentOptions } from 'http-problem-details/dist/ProblemDocument'
26 import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
29 MActorAccountChannelId,
30 MActorFollowActorsDefaultSubscription,
33 MCommentOwnerVideoReply,
39 MVideoRedundancyVideo,
43 } 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
91 data?: Record<string, Object>
94 } & ProblemDocumentOptions) => void
97 videoAll?: MVideoFullLight
98 onlyImmutableVideo?: MVideoImmutable
99 onlyVideo?: MVideoThumbnail
100 onlyVideoWithRights?: MVideoWithRights
101 videoId?: MVideoIdThumbnail
103 videoLive?: MVideoLive
105 videoShare?: MVideoShareActor
107 videoFile?: MVideoFile
109 videoFileResumable?: EnhancedUploadXFile
111 videoImport?: MVideoImportDefault
113 videoBlacklist?: MVideoBlacklist
115 videoCaption?: MVideoCaptionVideo
117 abuse?: MAbuseReporter
118 abuseMessage?: MAbuseMessage
120 videoStreamingPlaylist?: MStreamingPlaylist
122 videoChannel?: MChannelBannerAccountDefault
124 videoPlaylistFull?: MVideoPlaylistFull
125 videoPlaylistSummary?: MVideoPlaylistFullSummary
127 videoPlaylistElement?: MVideoPlaylistElement
128 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
130 accountVideoRate?: MAccountVideoRateAccountVideo
132 videoCommentFull?: MCommentOwnerVideoReply
133 videoCommentThread?: MComment
135 follow?: MActorFollowActorsDefault
136 subscription?: MActorFollowActorsDefaultSubscription
138 nextOwner?: MAccountDefault
139 videoChangeOwnership?: MVideoChangeOwnershipFull
141 account?: MAccountDefault
144 actorFull?: MActorFull
150 videoRedundancy?: MVideoRedundancyVideo
152 accountBlock?: MAccountBlocklist
153 serverBlock?: MServerBlocklist
156 token: MOAuthTokenUser
160 actor: MActorAccountChannelId
163 authenticated?: boolean
165 registeredPlugin?: RegisteredPlugin
167 externalAuth?: RegisterServerAuthExternalOptions