1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +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

@ -2,6 +2,7 @@ import * as express from 'express'
import toInt from 'validator/lib/toInt'
import { doJSONRequest } from '@server/helpers/requests'
import { LiveManager } from '@server/lib/live-manager'
import { docMiddleware } from '@server/middlewares/doc'
import { getServerActor } from '@server/models/application/application'
import { MVideoAccountLight } from '@server/types/models'
import { VideosCommonQuery } from '../../../../shared'
@ -83,6 +84,7 @@ videosRouter.get('/:id/metadata/:videoFileId',
asyncMiddleware(getVideoFileMetadata)
)
videosRouter.get('/:id',
docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo'),
optionalAuthenticate,
asyncMiddleware(videosCustomGetValidator('only-video-with-rights')),
asyncMiddleware(checkVideoFollowConstraints),
@ -94,6 +96,7 @@ videosRouter.post('/:id/views',
)
videosRouter.delete('/:id',
docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo'),
authenticate,
asyncMiddleware(videosRemoveValidator),
asyncRetryTransactionMiddleware(removeVideo)