]>
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' | |
c0e8b12e | 25 | import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models' |
f6d6e7f8 | 26 | import { File as UploadXFile, Metadata } from '@uploadx/core' |
c24aac6b | 27 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
453e83ea C |
28 | import { |
29 | MAccountDefault, | |
30 | MActorAccountChannelId, | |
453e83ea C |
31 | MActorFollowActorsDefaultSubscription, |
32 | MActorFull, | |
453e83ea C |
33 | MComment, |
34 | MCommentOwnerVideoReply, | |
35 | MUserDefault, | |
453e83ea C |
36 | MVideoBlacklist, |
37 | MVideoCaptionVideo, | |
38 | MVideoFullLight, | |
453e83ea C |
39 | MVideoRedundancyVideo, |
40 | MVideoShareActor, | |
20a206c3 | 41 | MVideoThumbnail |
c24aac6b | 42 | } from '../../types/models' |
e030bfb5 | 43 | |
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 | 89 | fail: (options: { |
76148b27 | 90 | message: string |
e030bfb5 C |
91 | |
92 | title?: string | |
93 | status?: number | |
94 | type?: ServerErrorCode | |
95 | instance?: string | |
96 | ||
97 | data?: PeerTubeProblemDocumentData | |
98 | }) => void | |
76148b27 | 99 | |
f6d6e7f8 | 100 | locals: { |
e030bfb5 C |
101 | docUrl?: string |
102 | ||
ca4b4b2e | 103 | videoAPI?: MVideoFormattableDetails |
f6d6e7f8 | 104 | videoAll?: MVideoFullLight |
105 | onlyImmutableVideo?: MVideoImmutable | |
106 | onlyVideo?: MVideoThumbnail | |
71d4af1e | 107 | videoId?: MVideoId |
453e83ea | 108 | |
f6d6e7f8 | 109 | videoLive?: MVideoLive |
453e83ea | 110 | |
f6d6e7f8 | 111 | videoShare?: MVideoShareActor |
dae86118 | 112 | |
f6d6e7f8 | 113 | videoFile?: MVideoFile |
dae86118 | 114 | |
f6d6e7f8 | 115 | videoFileResumable?: EnhancedUploadXFile |
dae86118 | 116 | |
f6d6e7f8 | 117 | videoImport?: MVideoImportDefault |
dae86118 | 118 | |
f6d6e7f8 | 119 | videoBlacklist?: MVideoBlacklist |
dae86118 | 120 | |
f6d6e7f8 | 121 | videoCaption?: MVideoCaptionVideo |
dae86118 | 122 | |
f6d6e7f8 | 123 | abuse?: MAbuseReporter |
124 | abuseMessage?: MAbuseMessage | |
dae86118 | 125 | |
f6d6e7f8 | 126 | videoStreamingPlaylist?: MStreamingPlaylist |
dae86118 | 127 | |
f6d6e7f8 | 128 | videoChannel?: MChannelBannerAccountDefault |
dae86118 | 129 | |
f6d6e7f8 | 130 | videoPlaylistFull?: MVideoPlaylistFull |
131 | videoPlaylistSummary?: MVideoPlaylistFullSummary | |
dae86118 | 132 | |
f6d6e7f8 | 133 | videoPlaylistElement?: MVideoPlaylistElement |
134 | videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy | |
dae86118 | 135 | |
f6d6e7f8 | 136 | accountVideoRate?: MAccountVideoRateAccountVideo |
dae86118 | 137 | |
f6d6e7f8 | 138 | videoCommentFull?: MCommentOwnerVideoReply |
139 | videoCommentThread?: MComment | |
dae86118 | 140 | |
f6d6e7f8 | 141 | follow?: MActorFollowActorsDefault |
142 | subscription?: MActorFollowActorsDefaultSubscription | |
dae86118 | 143 | |
f6d6e7f8 | 144 | nextOwner?: MAccountDefault |
145 | videoChangeOwnership?: MVideoChangeOwnershipFull | |
dae86118 | 146 | |
f6d6e7f8 | 147 | account?: MAccountDefault |
dae86118 | 148 | |
f6d6e7f8 | 149 | actorUrl?: MActorUrl |
150 | actorFull?: MActorFull | |
151 | ||
152 | user?: MUserDefault | |
153 | ||
154 | server?: MServer | |
155 | ||
156 | videoRedundancy?: MVideoRedundancyVideo | |
dae86118 | 157 | |
f6d6e7f8 | 158 | accountBlock?: MAccountBlocklist |
159 | serverBlock?: MServerBlocklist | |
345da516 | 160 | |
f6d6e7f8 | 161 | oauth?: { |
162 | token: MOAuthTokenUser | |
163 | } | |
ad91e700 | 164 | |
f6d6e7f8 | 165 | signature?: { |
166 | actor: MActorAccountChannelId | |
167 | } | |
4a8d113b | 168 | |
f6d6e7f8 | 169 | authenticated?: boolean |
170 | ||
171 | registeredPlugin?: RegisteredPlugin | |
172 | ||
173 | externalAuth?: RegisterServerAuthExternalOptions | |
174 | ||
175 | plugin?: MPlugin | |
176 | } | |
177 | } | |
dae86118 | 178 | } |