]>
Commit | Line | Data |
---|---|---|
e030bfb5 | 1 | |
67ed6552 C |
2 | import { RegisterServerAuthExternalOptions } from '@server/types' |
3 | import { | |
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' |
20 | import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' | |
21 | import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server' | |
22 | import { MVideoImportDefault } from '@server/types/models/video/video-import' | |
23 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' | |
24 | import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' | |
f6d6e7f8 | 25 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' |
e030bfb5 | 26 | import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models' |
f6d6e7f8 | 27 | import { File as UploadXFile, Metadata } from '@uploadx/core' |
c24aac6b | 28 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
453e83ea C |
29 | import { |
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, | |
40 | MVideoIdThumbnail, | |
41 | MVideoRedundancyVideo, | |
42 | MVideoShareActor, | |
43 | MVideoThumbnail, | |
44 | MVideoWithRights | |
c24aac6b | 45 | } from '../../types/models' |
e030bfb5 | 46 | |
dae86118 | 47 | declare module 'express' { |
26d6bf65 | 48 | export interface Request { |
faa9d434 | 49 | query: any |
f6d6e7f8 | 50 | method: HttpMethod |
faa9d434 | 51 | } |
f6d6e7f8 | 52 | |
53 | // Upload using multer or uploadx middleware | |
54 | export type MulterOrUploadXFile = UploadXFile | Express.Multer.File | |
55 | ||
56 | export type UploadFiles = { | |
57 | [fieldname: string]: MulterOrUploadXFile[] | |
58 | } | MulterOrUploadXFile[] | |
59 | ||
60 | // Partial object used by some functions to check the file mimetype/extension | |
61 | export type UploadFileForCheck = { | |
62 | originalname: string | |
63 | mimetype: string | |
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: { |
e030bfb5 C |
104 | docUrl?: string |
105 | ||
ca4b4b2e | 106 | videoAPI?: MVideoFormattableDetails |
f6d6e7f8 | 107 | videoAll?: MVideoFullLight |
108 | onlyImmutableVideo?: MVideoImmutable | |
109 | onlyVideo?: MVideoThumbnail | |
71d4af1e | 110 | videoId?: MVideoId |
453e83ea | 111 | |
f6d6e7f8 | 112 | videoLive?: MVideoLive |
453e83ea | 113 | |
f6d6e7f8 | 114 | videoShare?: MVideoShareActor |
dae86118 | 115 | |
f6d6e7f8 | 116 | videoFile?: MVideoFile |
dae86118 | 117 | |
f6d6e7f8 | 118 | videoFileResumable?: EnhancedUploadXFile |
dae86118 | 119 | |
f6d6e7f8 | 120 | videoImport?: MVideoImportDefault |
dae86118 | 121 | |
f6d6e7f8 | 122 | videoBlacklist?: MVideoBlacklist |
dae86118 | 123 | |
f6d6e7f8 | 124 | videoCaption?: MVideoCaptionVideo |
dae86118 | 125 | |
f6d6e7f8 | 126 | abuse?: MAbuseReporter |
127 | abuseMessage?: MAbuseMessage | |
dae86118 | 128 | |
f6d6e7f8 | 129 | videoStreamingPlaylist?: MStreamingPlaylist |
dae86118 | 130 | |
f6d6e7f8 | 131 | videoChannel?: MChannelBannerAccountDefault |
dae86118 | 132 | |
f6d6e7f8 | 133 | videoPlaylistFull?: MVideoPlaylistFull |
134 | videoPlaylistSummary?: MVideoPlaylistFullSummary | |
dae86118 | 135 | |
f6d6e7f8 | 136 | videoPlaylistElement?: MVideoPlaylistElement |
137 | videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy | |
dae86118 | 138 | |
f6d6e7f8 | 139 | accountVideoRate?: MAccountVideoRateAccountVideo |
dae86118 | 140 | |
f6d6e7f8 | 141 | videoCommentFull?: MCommentOwnerVideoReply |
142 | videoCommentThread?: MComment | |
dae86118 | 143 | |
f6d6e7f8 | 144 | follow?: MActorFollowActorsDefault |
145 | subscription?: MActorFollowActorsDefaultSubscription | |
dae86118 | 146 | |
f6d6e7f8 | 147 | nextOwner?: MAccountDefault |
148 | videoChangeOwnership?: MVideoChangeOwnershipFull | |
dae86118 | 149 | |
f6d6e7f8 | 150 | account?: MAccountDefault |
dae86118 | 151 | |
f6d6e7f8 | 152 | actorUrl?: MActorUrl |
153 | actorFull?: MActorFull | |
154 | ||
155 | user?: MUserDefault | |
156 | ||
157 | server?: MServer | |
158 | ||
159 | videoRedundancy?: MVideoRedundancyVideo | |
dae86118 | 160 | |
f6d6e7f8 | 161 | accountBlock?: MAccountBlocklist |
162 | serverBlock?: MServerBlocklist | |
345da516 | 163 | |
f6d6e7f8 | 164 | oauth?: { |
165 | token: MOAuthTokenUser | |
166 | } | |
ad91e700 | 167 | |
f6d6e7f8 | 168 | signature?: { |
169 | actor: MActorAccountChannelId | |
170 | } | |
4a8d113b | 171 | |
f6d6e7f8 | 172 | authenticated?: boolean |
173 | ||
174 | registeredPlugin?: RegisteredPlugin | |
175 | ||
176 | externalAuth?: RegisterServerAuthExternalOptions | |
177 | ||
178 | plugin?: MPlugin | |
179 | } | |
180 | } | |
dae86118 | 181 | } |