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