diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
commit | e030bfb59dd5ee65f20a64686ec9b22ca39f70ae (patch) | |
tree | c9a439159ef540291e3c030bcaf958b953442147 /server/controllers/api/videos/upload.ts | |
parent | 463206948d6a9d46e7e68d55c7b763e601ecc870 (diff) | |
download | PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.gz PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.zst PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.zip |
Refactor server errors handler
Diffstat (limited to 'server/controllers/api/videos/upload.ts')
-rw-r--r-- | server/controllers/api/videos/upload.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index c33d7fcb9..93a68f759 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts | |||
@@ -6,6 +6,7 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | |||
6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
7 | import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' | 7 | import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' |
8 | import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' | 8 | import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' |
9 | import { docMiddleware } from '@server/middlewares/doc' | ||
9 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 10 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
10 | import { uploadx } from '@uploadx/core' | 11 | import { uploadx } from '@uploadx/core' |
11 | import { VideoCreate, VideoState } from '../../../../shared' | 12 | import { VideoCreate, VideoState } from '../../../../shared' |
@@ -60,6 +61,7 @@ const reqVideoFileAddResumable = createReqFiles( | |||
60 | ) | 61 | ) |
61 | 62 | ||
62 | uploadRouter.post('/upload', | 63 | uploadRouter.post('/upload', |
64 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadLegacy'), | ||
63 | authenticate, | 65 | authenticate, |
64 | reqVideoFileAdd, | 66 | reqVideoFileAdd, |
65 | asyncMiddleware(videosAddLegacyValidator), | 67 | asyncMiddleware(videosAddLegacyValidator), |
@@ -67,6 +69,7 @@ uploadRouter.post('/upload', | |||
67 | ) | 69 | ) |
68 | 70 | ||
69 | uploadRouter.post('/upload-resumable', | 71 | uploadRouter.post('/upload-resumable', |
72 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumableInit'), | ||
70 | authenticate, | 73 | authenticate, |
71 | reqVideoFileAddResumable, | 74 | reqVideoFileAddResumable, |
72 | asyncMiddleware(videosAddResumableInitValidator), | 75 | asyncMiddleware(videosAddResumableInitValidator), |
@@ -79,6 +82,7 @@ uploadRouter.delete('/upload-resumable', | |||
79 | ) | 82 | ) |
80 | 83 | ||
81 | uploadRouter.put('/upload-resumable', | 84 | uploadRouter.put('/upload-resumable', |
85 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumable'), | ||
82 | authenticate, | 86 | authenticate, |
83 | uploadxMiddleware, // uploadx doesn't use call next() before the file upload completes | 87 | uploadxMiddleware, // uploadx doesn't use call next() before the file upload completes |
84 | asyncMiddleware(videosAddResumableValidator), | 88 | asyncMiddleware(videosAddResumableValidator), |