]>
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, | |
13 | MVideoImmutable, | |
fbd51e69 | 14 | MVideoLive, |
67ed6552 | 15 | MVideoPlaylistFull, |
fbd51e69 | 16 | MVideoPlaylistFullSummary |
67ed6552 C |
17 | } from '@server/types/models' |
18 | import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' | |
19 | import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server' | |
20 | import { MVideoImportDefault } from '@server/types/models/video/video-import' | |
21 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' | |
22 | import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' | |
f6d6e7f8 | 23 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' |
e030bfb5 | 24 | import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models' |
f6d6e7f8 | 25 | import { File as UploadXFile, Metadata } from '@uploadx/core' |
c24aac6b | 26 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
453e83ea C |
27 | import { |
28 | MAccountDefault, | |
29 | MActorAccountChannelId, | |
453e83ea C |
30 | MActorFollowActorsDefaultSubscription, |
31 | MActorFull, | |
453e83ea C |
32 | MComment, |
33 | MCommentOwnerVideoReply, | |
34 | MUserDefault, | |
453e83ea C |
35 | MVideoBlacklist, |
36 | MVideoCaptionVideo, | |
37 | MVideoFullLight, | |
38 | MVideoIdThumbnail, | |
39 | MVideoRedundancyVideo, | |
40 | MVideoShareActor, | |
41 | MVideoThumbnail, | |
42 | MVideoWithRights | |
c24aac6b | 43 | } from '../../types/models' |
e030bfb5 | 44 | |
dae86118 | 45 | declare 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 | ||
f6d6e7f8 | 104 | videoAll?: MVideoFullLight |
105 | onlyImmutableVideo?: MVideoImmutable | |
106 | onlyVideo?: MVideoThumbnail | |
107 | onlyVideoWithRights?: MVideoWithRights | |
108 | videoId?: MVideoIdThumbnail | |
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 | } |