]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/express.d.ts
Translated using Weblate (Vietnamese)
[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
453e83ea 122
f6d6e7f8 123 videoShare?: MVideoShareActor
dae86118 124
f6d6e7f8 125 videoFile?: MVideoFile
dae86118 126
f6d6e7f8 127 videoFileResumable?: EnhancedUploadXFile
dae86118 128
f6d6e7f8 129 videoImport?: MVideoImportDefault
dae86118 130
f6d6e7f8 131 videoBlacklist?: MVideoBlacklist
dae86118 132
f6d6e7f8 133 videoCaption?: MVideoCaptionVideo
dae86118 134
f6d6e7f8 135 abuse?: MAbuseReporter
136 abuseMessage?: MAbuseMessage
dae86118 137
f6d6e7f8 138 videoStreamingPlaylist?: MStreamingPlaylist
dae86118 139
f6d6e7f8 140 videoChannel?: MChannelBannerAccountDefault
dae86118 141
f6d6e7f8 142 videoPlaylistFull?: MVideoPlaylistFull
143 videoPlaylistSummary?: MVideoPlaylistFullSummary
dae86118 144
f6d6e7f8 145 videoPlaylistElement?: MVideoPlaylistElement
146 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
dae86118 147
f6d6e7f8 148 accountVideoRate?: MAccountVideoRateAccountVideo
dae86118 149
f6d6e7f8 150 videoCommentFull?: MCommentOwnerVideoReply
151 videoCommentThread?: MComment
dae86118 152
f6d6e7f8 153 follow?: MActorFollowActorsDefault
154 subscription?: MActorFollowActorsDefaultSubscription
dae86118 155
f6d6e7f8 156 nextOwner?: MAccountDefault
157 videoChangeOwnership?: MVideoChangeOwnershipFull
dae86118 158
f6d6e7f8 159 account?: MAccountDefault
dae86118 160
f6d6e7f8 161 actorUrl?: MActorUrl
162 actorFull?: MActorFull
163
164 user?: MUserDefault
165
166 server?: MServer
167
168 videoRedundancy?: MVideoRedundancyVideo
dae86118 169
f6d6e7f8 170 accountBlock?: MAccountBlocklist
171 serverBlock?: MServerBlocklist
345da516 172
f6d6e7f8 173 oauth?: {
174 token: MOAuthTokenUser
175 }
ad91e700 176
f6d6e7f8 177 signature?: {
178 actor: MActorAccountChannelId
179 }
4a8d113b 180
f6d6e7f8 181 authenticated?: boolean
182
183 registeredPlugin?: RegisteredPlugin
184
185 externalAuth?: RegisterServerAuthExternalOptions
186
187 plugin?: MPlugin
b2111066
C
188
189 localViewerFull?: MLocalVideoViewerWithWatchSections
f6d6e7f8 190 }
191 }
dae86118 192}