]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/express.d.ts
Support live session in server
[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
c729caf6 43} from './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
c729caf6 63 size: number
fbd51e69 64 }
453e83ea 65
f6d6e7f8 66 export type UploadFilesForCheck = {
67 [fieldname: string]: UploadFileForCheck[]
68 } | UploadFileForCheck[]
453e83ea 69
f6d6e7f8 70 // Upload file with a duration added by our middleware
71 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
72 duration: number
73 }
c6c0fa6c 74
f6d6e7f8 75 // Extends Metadata property of UploadX object
76 export type UploadXFileMetadata = Metadata & VideoCreate & {
77 previewfile: Express.Multer.File[]
78 thumbnailfile: Express.Multer.File[]
79 }
453e83ea 80
f6d6e7f8 81 // Our custom UploadXFile object using our custom metadata
82 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
453e83ea 83
f6d6e7f8 84 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
85 duration: number
86 path: string
87 filename: string
88 }
453e83ea 89
76148b27 90 // Extends Response with added functions and potential variables passed by middlewares
f6d6e7f8 91 interface Response {
76148b27 92 fail: (options: {
76148b27 93 message: string
e030bfb5
C
94
95 title?: string
96 status?: number
97 type?: ServerErrorCode
98 instance?: string
99
100 data?: PeerTubeProblemDocumentData
101 }) => void
76148b27 102
f6d6e7f8 103 locals: {
20bafcb6
C
104 apicache: {
105 content: string | Buffer
106 write: Writable['write']
107 writeHead: Response['writeHead']
108 end: Response['end']
109 cacheable: boolean
110 headers: OutgoingHttpHeaders
111 }
112
e030bfb5
C
113 docUrl?: string
114
ca4b4b2e 115 videoAPI?: MVideoFormattableDetails
f6d6e7f8 116 videoAll?: MVideoFullLight
117 onlyImmutableVideo?: MVideoImmutable
118 onlyVideo?: MVideoThumbnail
71d4af1e 119 videoId?: MVideoId
453e83ea 120
f6d6e7f8 121 videoLive?: MVideoLive
26e3e98f 122 videoLiveSession?: MVideoLiveSession
453e83ea 123
f6d6e7f8 124 videoShare?: MVideoShareActor
dae86118 125
f6d6e7f8 126 videoFile?: MVideoFile
dae86118 127
f6d6e7f8 128 videoFileResumable?: EnhancedUploadXFile
dae86118 129
f6d6e7f8 130 videoImport?: MVideoImportDefault
dae86118 131
f6d6e7f8 132 videoBlacklist?: MVideoBlacklist
dae86118 133
f6d6e7f8 134 videoCaption?: MVideoCaptionVideo
dae86118 135
f6d6e7f8 136 abuse?: MAbuseReporter
137 abuseMessage?: MAbuseMessage
dae86118 138
f6d6e7f8 139 videoStreamingPlaylist?: MStreamingPlaylist
dae86118 140
f6d6e7f8 141 videoChannel?: MChannelBannerAccountDefault
dae86118 142
f6d6e7f8 143 videoPlaylistFull?: MVideoPlaylistFull
144 videoPlaylistSummary?: MVideoPlaylistFullSummary
dae86118 145
f6d6e7f8 146 videoPlaylistElement?: MVideoPlaylistElement
147 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
dae86118 148
f6d6e7f8 149 accountVideoRate?: MAccountVideoRateAccountVideo
dae86118 150
f6d6e7f8 151 videoCommentFull?: MCommentOwnerVideoReply
152 videoCommentThread?: MComment
dae86118 153
f6d6e7f8 154 follow?: MActorFollowActorsDefault
155 subscription?: MActorFollowActorsDefaultSubscription
dae86118 156
f6d6e7f8 157 nextOwner?: MAccountDefault
158 videoChangeOwnership?: MVideoChangeOwnershipFull
dae86118 159
f6d6e7f8 160 account?: MAccountDefault
dae86118 161
f6d6e7f8 162 actorUrl?: MActorUrl
163 actorFull?: MActorFull
164
165 user?: MUserDefault
166
167 server?: MServer
168
169 videoRedundancy?: MVideoRedundancyVideo
dae86118 170
f6d6e7f8 171 accountBlock?: MAccountBlocklist
172 serverBlock?: MServerBlocklist
345da516 173
f6d6e7f8 174 oauth?: {
175 token: MOAuthTokenUser
176 }
ad91e700 177
f6d6e7f8 178 signature?: {
179 actor: MActorAccountChannelId
180 }
4a8d113b 181
f6d6e7f8 182 authenticated?: boolean
183
184 registeredPlugin?: RegisteredPlugin
185
186 externalAuth?: RegisterServerAuthExternalOptions
187
188 plugin?: MPlugin
b2111066
C
189
190 localViewerFull?: MLocalVideoViewerWithWatchSections
f6d6e7f8 191 }
192 }
dae86118 193}