]>
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' | |
c24aac6b | 25 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
453e83ea C |
26 | import { |
27 | MAccountDefault, | |
28 | MActorAccountChannelId, | |
453e83ea C |
29 | MActorFollowActorsDefaultSubscription, |
30 | MActorFull, | |
453e83ea C |
31 | MComment, |
32 | MCommentOwnerVideoReply, | |
33 | MUserDefault, | |
453e83ea C |
34 | MVideoBlacklist, |
35 | MVideoCaptionVideo, | |
36 | MVideoFullLight, | |
37 | MVideoIdThumbnail, | |
38 | MVideoRedundancyVideo, | |
39 | MVideoShareActor, | |
40 | MVideoThumbnail, | |
41 | MVideoWithRights | |
c24aac6b | 42 | } from '../../types/models' |
dae86118 | 43 | declare module 'express' { |
26d6bf65 | 44 | export interface Request { |
faa9d434 | 45 | query: any |
f6d6e7f8 | 46 | method: HttpMethod |
faa9d434 | 47 | } |
f6d6e7f8 | 48 | |
49 | // Upload using multer or uploadx middleware | |
50 | export type MulterOrUploadXFile = UploadXFile | Express.Multer.File | |
51 | ||
52 | export type UploadFiles = { | |
53 | [fieldname: string]: MulterOrUploadXFile[] | |
54 | } | MulterOrUploadXFile[] | |
55 | ||
56 | // Partial object used by some functions to check the file mimetype/extension | |
57 | export type UploadFileForCheck = { | |
58 | originalname: string | |
59 | mimetype: string | |
fbd51e69 | 60 | } |
453e83ea | 61 | |
f6d6e7f8 | 62 | export type UploadFilesForCheck = { |
63 | [fieldname: string]: UploadFileForCheck[] | |
64 | } | UploadFileForCheck[] | |
453e83ea | 65 | |
f6d6e7f8 | 66 | // Upload file with a duration added by our middleware |
67 | export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & { | |
68 | duration: number | |
69 | } | |
c6c0fa6c | 70 | |
f6d6e7f8 | 71 | // Extends Metadata property of UploadX object |
72 | export type UploadXFileMetadata = Metadata & VideoCreate & { | |
73 | previewfile: Express.Multer.File[] | |
74 | thumbnailfile: Express.Multer.File[] | |
75 | } | |
453e83ea | 76 | |
f6d6e7f8 | 77 | // Our custom UploadXFile object using our custom metadata |
78 | export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T } | |
453e83ea | 79 | |
f6d6e7f8 | 80 | export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & { |
81 | duration: number | |
82 | path: string | |
83 | filename: string | |
84 | } | |
453e83ea | 85 | |
f6d6e7f8 | 86 | // Extends locals property from Response |
87 | interface Response { | |
88 | locals: { | |
89 | videoAll?: MVideoFullLight | |
90 | onlyImmutableVideo?: MVideoImmutable | |
91 | onlyVideo?: MVideoThumbnail | |
92 | onlyVideoWithRights?: MVideoWithRights | |
93 | videoId?: MVideoIdThumbnail | |
453e83ea | 94 | |
f6d6e7f8 | 95 | videoLive?: MVideoLive |
453e83ea | 96 | |
f6d6e7f8 | 97 | videoShare?: MVideoShareActor |
dae86118 | 98 | |
f6d6e7f8 | 99 | videoFile?: MVideoFile |
dae86118 | 100 | |
f6d6e7f8 | 101 | videoFileResumable?: EnhancedUploadXFile |
dae86118 | 102 | |
f6d6e7f8 | 103 | videoImport?: MVideoImportDefault |
dae86118 | 104 | |
f6d6e7f8 | 105 | videoBlacklist?: MVideoBlacklist |
dae86118 | 106 | |
f6d6e7f8 | 107 | videoCaption?: MVideoCaptionVideo |
dae86118 | 108 | |
f6d6e7f8 | 109 | abuse?: MAbuseReporter |
110 | abuseMessage?: MAbuseMessage | |
dae86118 | 111 | |
f6d6e7f8 | 112 | videoStreamingPlaylist?: MStreamingPlaylist |
dae86118 | 113 | |
f6d6e7f8 | 114 | videoChannel?: MChannelBannerAccountDefault |
dae86118 | 115 | |
f6d6e7f8 | 116 | videoPlaylistFull?: MVideoPlaylistFull |
117 | videoPlaylistSummary?: MVideoPlaylistFullSummary | |
dae86118 | 118 | |
f6d6e7f8 | 119 | videoPlaylistElement?: MVideoPlaylistElement |
120 | videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy | |
dae86118 | 121 | |
f6d6e7f8 | 122 | accountVideoRate?: MAccountVideoRateAccountVideo |
dae86118 | 123 | |
f6d6e7f8 | 124 | videoCommentFull?: MCommentOwnerVideoReply |
125 | videoCommentThread?: MComment | |
dae86118 | 126 | |
f6d6e7f8 | 127 | follow?: MActorFollowActorsDefault |
128 | subscription?: MActorFollowActorsDefaultSubscription | |
dae86118 | 129 | |
f6d6e7f8 | 130 | nextOwner?: MAccountDefault |
131 | videoChangeOwnership?: MVideoChangeOwnershipFull | |
dae86118 | 132 | |
f6d6e7f8 | 133 | account?: MAccountDefault |
dae86118 | 134 | |
f6d6e7f8 | 135 | actorUrl?: MActorUrl |
136 | actorFull?: MActorFull | |
137 | ||
138 | user?: MUserDefault | |
139 | ||
140 | server?: MServer | |
141 | ||
142 | videoRedundancy?: MVideoRedundancyVideo | |
dae86118 | 143 | |
f6d6e7f8 | 144 | accountBlock?: MAccountBlocklist |
145 | serverBlock?: MServerBlocklist | |
345da516 | 146 | |
f6d6e7f8 | 147 | oauth?: { |
148 | token: MOAuthTokenUser | |
149 | } | |
ad91e700 | 150 | |
f6d6e7f8 | 151 | signature?: { |
152 | actor: MActorAccountChannelId | |
153 | } | |
4a8d113b | 154 | |
f6d6e7f8 | 155 | authenticated?: boolean |
156 | ||
157 | registeredPlugin?: RegisteredPlugin | |
158 | ||
159 | externalAuth?: RegisterServerAuthExternalOptions | |
160 | ||
161 | plugin?: MPlugin | |
162 | } | |
163 | } | |
dae86118 | 164 | } |