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 { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
28 MActorAccountChannelId,
29 MActorFollowActorsDefaultSubscription,
32 MCommentOwnerVideoReply,
38 MVideoRedundancyVideo,
42 } from '../../types/models'
43 declare module 'express' {
44 export interface Request {
49 // Upload using multer or uploadx middleware
50 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
52 export type UploadFiles = {
53 [fieldname: string]: MulterOrUploadXFile[]
54 } | MulterOrUploadXFile[]
56 // Partial object used by some functions to check the file mimetype/extension
57 export type UploadFileForCheck = {
62 export type UploadFilesForCheck = {
63 [fieldname: string]: UploadFileForCheck[]
64 } | UploadFileForCheck[]
66 // Upload file with a duration added by our middleware
67 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
71 // Extends Metadata property of UploadX object
72 export type UploadXFileMetadata = Metadata & VideoCreate & {
73 previewfile: Express.Multer.File[]
74 thumbnailfile: Express.Multer.File[]
77 // Our custom UploadXFile object using our custom metadata
78 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
80 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
86 // Extends locals property from Response
89 videoAll?: MVideoFullLight
90 onlyImmutableVideo?: MVideoImmutable
91 onlyVideo?: MVideoThumbnail
92 onlyVideoWithRights?: MVideoWithRights
93 videoId?: MVideoIdThumbnail
95 videoLive?: MVideoLive
97 videoShare?: MVideoShareActor
99 videoFile?: MVideoFile
101 videoFileResumable?: EnhancedUploadXFile
103 videoImport?: MVideoImportDefault
105 videoBlacklist?: MVideoBlacklist
107 videoCaption?: MVideoCaptionVideo
109 abuse?: MAbuseReporter
110 abuseMessage?: MAbuseMessage
112 videoStreamingPlaylist?: MStreamingPlaylist
114 videoChannel?: MChannelBannerAccountDefault
116 videoPlaylistFull?: MVideoPlaylistFull
117 videoPlaylistSummary?: MVideoPlaylistFullSummary
119 videoPlaylistElement?: MVideoPlaylistElement
120 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
122 accountVideoRate?: MAccountVideoRateAccountVideo
124 videoCommentFull?: MCommentOwnerVideoReply
125 videoCommentThread?: MComment
127 follow?: MActorFollowActorsDefault
128 subscription?: MActorFollowActorsDefaultSubscription
130 nextOwner?: MAccountDefault
131 videoChangeOwnership?: MVideoChangeOwnershipFull
133 account?: MAccountDefault
136 actorFull?: MActorFull
142 videoRedundancy?: MVideoRedundancyVideo
144 accountBlock?: MAccountBlocklist
145 serverBlock?: MServerBlocklist
148 token: MOAuthTokenUser
152 actor: MActorAccountChannelId
155 authenticated?: boolean
157 registeredPlugin?: RegisteredPlugin
159 externalAuth?: RegisterServerAuthExternalOptions