1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Refactor server errors handler

This commit is contained in:
Chocobozzz 2021-06-02 18:15:41 +02:00
parent 463206948d
commit e030bfb59d
No known key found for this signature in database
GPG key ID: 583A612D890159BE
20 changed files with 236 additions and 60 deletions

View file

@ -6,6 +6,7 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
import { docMiddleware } from '@server/middlewares/doc'
import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
import { uploadx } from '@uploadx/core'
import { VideoCreate, VideoState } from '../../../../shared'
@ -60,6 +61,7 @@ const reqVideoFileAddResumable = createReqFiles(
)
uploadRouter.post('/upload',
docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadLegacy'),
authenticate,
reqVideoFileAdd,
asyncMiddleware(videosAddLegacyValidator),
@ -67,6 +69,7 @@ uploadRouter.post('/upload',
)
uploadRouter.post('/upload-resumable',
docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumableInit'),
authenticate,
reqVideoFileAddResumable,
asyncMiddleware(videosAddResumableInitValidator),
@ -79,6 +82,7 @@ uploadRouter.delete('/upload-resumable',
)
uploadRouter.put('/upload-resumable',
docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumable'),
authenticate,
uploadxMiddleware, // uploadx doesn't use call next() before the file upload completes
asyncMiddleware(videosAddResumableValidator),