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