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