]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/express.d.ts
Try to fix ARM docker builds
[github/Chocobozzz/PeerTube.git] / server / types / express.d.ts
CommitLineData
e030bfb5 1
20bafcb6 2import { OutgoingHttpHeaders } from 'http'
67ed6552
C
3import { RegisterServerAuthExternalOptions } from '@server/types'
4import {
edbc9325 5 MAbuseMessage,
668b7f09 6 MAbuseReporter,
67ed6552 7 MAccountBlocklist,
2cb03dc1 8 MActorFollowActorsDefault,
67ed6552 9 MActorUrl,
2cb03dc1 10 MChannelBannerAccountDefault,
67ed6552
C
11 MStreamingPlaylist,
12 MVideoChangeOwnershipFull,
13 MVideoFile,
ca4b4b2e 14 MVideoFormattableDetails,
71d4af1e 15 MVideoId,
67ed6552 16 MVideoImmutable,
fbd51e69 17 MVideoLive,
67ed6552 18 MVideoPlaylistFull,
fbd51e69 19 MVideoPlaylistFullSummary
67ed6552
C
20} from '@server/types/models'
21import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
22import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
23import { MVideoImportDefault } from '@server/types/models/video/video-import'
24import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
25import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
c0e8b12e 26import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
f6d6e7f8 27import { File as UploadXFile, Metadata } from '@uploadx/core'
c24aac6b 28import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
453e83ea
C
29import {
30 MAccountDefault,
31 MActorAccountChannelId,
453e83ea
C
32 MActorFollowActorsDefaultSubscription,
33 MActorFull,
453e83ea
C
34 MComment,
35 MCommentOwnerVideoReply,
36 MUserDefault,
453e83ea
C
37 MVideoBlacklist,
38 MVideoCaptionVideo,
39 MVideoFullLight,
453e83ea
C
40 MVideoRedundancyVideo,
41 MVideoShareActor,
20a206c3 42 MVideoThumbnail
c24aac6b 43} from '../../types/models'
20bafcb6 44import { Writable } from 'stream'
e030bfb5 45
dae86118 46declare module 'express' {
26d6bf65 47 export interface Request {
faa9d434 48 query: any
f6d6e7f8 49 method: HttpMethod
faa9d434 50 }
f6d6e7f8 51
52 // Upload using multer or uploadx middleware
53 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
54
55 export type UploadFiles = {
56 [fieldname: string]: MulterOrUploadXFile[]
57 } | MulterOrUploadXFile[]
58
59 // Partial object used by some functions to check the file mimetype/extension
60 export type UploadFileForCheck = {
61 originalname: string
62 mimetype: string
fbd51e69 63 }
453e83ea 64
f6d6e7f8 65 export type UploadFilesForCheck = {
66 [fieldname: string]: UploadFileForCheck[]
67 } | UploadFileForCheck[]
453e83ea 68
f6d6e7f8 69 // Upload file with a duration added by our middleware
70 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
71 duration: number
72 }
c6c0fa6c 73
f6d6e7f8 74 // Extends Metadata property of UploadX object
75 export type UploadXFileMetadata = Metadata & VideoCreate & {
76 previewfile: Express.Multer.File[]
77 thumbnailfile: Express.Multer.File[]
78 }
453e83ea 79
f6d6e7f8 80 // Our custom UploadXFile object using our custom metadata
81 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
453e83ea 82
f6d6e7f8 83 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
84 duration: number
85 path: string
86 filename: string
87 }
453e83ea 88
76148b27 89 // Extends Response with added functions and potential variables passed by middlewares
f6d6e7f8 90 interface Response {
76148b27 91 fail: (options: {
76148b27 92 message: string
e030bfb5
C
93
94 title?: string
95 status?: number
96 type?: ServerErrorCode
97 instance?: string
98
99 data?: PeerTubeProblemDocumentData
100 }) => void
76148b27 101
f6d6e7f8 102 locals: {
20bafcb6
C
103 apicache: {
104 content: string | Buffer
105 write: Writable['write']
106 writeHead: Response['writeHead']
107 end: Response['end']
108 cacheable: boolean
109 headers: OutgoingHttpHeaders
110 }
111
e030bfb5
C
112 docUrl?: string
113
ca4b4b2e 114 videoAPI?: MVideoFormattableDetails
f6d6e7f8 115 videoAll?: MVideoFullLight
116 onlyImmutableVideo?: MVideoImmutable
117 onlyVideo?: MVideoThumbnail
71d4af1e 118 videoId?: MVideoId
453e83ea 119
f6d6e7f8 120 videoLive?: MVideoLive
453e83ea 121
f6d6e7f8 122 videoShare?: MVideoShareActor
dae86118 123
f6d6e7f8 124 videoFile?: MVideoFile
dae86118 125
f6d6e7f8 126 videoFileResumable?: EnhancedUploadXFile
dae86118 127
f6d6e7f8 128 videoImport?: MVideoImportDefault
dae86118 129
f6d6e7f8 130 videoBlacklist?: MVideoBlacklist
dae86118 131
f6d6e7f8 132 videoCaption?: MVideoCaptionVideo
dae86118 133
f6d6e7f8 134 abuse?: MAbuseReporter
135 abuseMessage?: MAbuseMessage
dae86118 136
f6d6e7f8 137 videoStreamingPlaylist?: MStreamingPlaylist
dae86118 138
f6d6e7f8 139 videoChannel?: MChannelBannerAccountDefault
dae86118 140
f6d6e7f8 141 videoPlaylistFull?: MVideoPlaylistFull
142 videoPlaylistSummary?: MVideoPlaylistFullSummary
dae86118 143
f6d6e7f8 144 videoPlaylistElement?: MVideoPlaylistElement
145 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
dae86118 146
f6d6e7f8 147 accountVideoRate?: MAccountVideoRateAccountVideo
dae86118 148
f6d6e7f8 149 videoCommentFull?: MCommentOwnerVideoReply
150 videoCommentThread?: MComment
dae86118 151
f6d6e7f8 152 follow?: MActorFollowActorsDefault
153 subscription?: MActorFollowActorsDefaultSubscription
dae86118 154
f6d6e7f8 155 nextOwner?: MAccountDefault
156 videoChangeOwnership?: MVideoChangeOwnershipFull
dae86118 157
f6d6e7f8 158 account?: MAccountDefault
dae86118 159
f6d6e7f8 160 actorUrl?: MActorUrl
161 actorFull?: MActorFull
162
163 user?: MUserDefault
164
165 server?: MServer
166
167 videoRedundancy?: MVideoRedundancyVideo
dae86118 168
f6d6e7f8 169 accountBlock?: MAccountBlocklist
170 serverBlock?: MServerBlocklist
345da516 171
f6d6e7f8 172 oauth?: {
173 token: MOAuthTokenUser
174 }
ad91e700 175
f6d6e7f8 176 signature?: {
177 actor: MActorAccountChannelId
178 }
4a8d113b 179
f6d6e7f8 180 authenticated?: boolean
181
182 registeredPlugin?: RegisteredPlugin
183
184 externalAuth?: RegisterServerAuthExternalOptions
185
186 plugin?: MPlugin
187 }
188 }
dae86118 189}