diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/index.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/update.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/upload.ts | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index db23e5630..7671f099e 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -2,6 +2,7 @@ import * as express from 'express' | |||
2 | import toInt from 'validator/lib/toInt' | 2 | import toInt from 'validator/lib/toInt' |
3 | import { doJSONRequest } from '@server/helpers/requests' | 3 | import { doJSONRequest } from '@server/helpers/requests' |
4 | import { LiveManager } from '@server/lib/live-manager' | 4 | import { LiveManager } from '@server/lib/live-manager' |
5 | import { docMiddleware } from '@server/middlewares/doc' | ||
5 | import { getServerActor } from '@server/models/application/application' | 6 | import { getServerActor } from '@server/models/application/application' |
6 | import { MVideoAccountLight } from '@server/types/models' | 7 | import { MVideoAccountLight } from '@server/types/models' |
7 | import { VideosCommonQuery } from '../../../../shared' | 8 | import { VideosCommonQuery } from '../../../../shared' |
@@ -83,6 +84,7 @@ videosRouter.get('/:id/metadata/:videoFileId', | |||
83 | asyncMiddleware(getVideoFileMetadata) | 84 | asyncMiddleware(getVideoFileMetadata) |
84 | ) | 85 | ) |
85 | videosRouter.get('/:id', | 86 | videosRouter.get('/:id', |
87 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo'), | ||
86 | optionalAuthenticate, | 88 | optionalAuthenticate, |
87 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), | 89 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), |
88 | asyncMiddleware(checkVideoFollowConstraints), | 90 | asyncMiddleware(checkVideoFollowConstraints), |
@@ -94,6 +96,7 @@ videosRouter.post('/:id/views', | |||
94 | ) | 96 | ) |
95 | 97 | ||
96 | videosRouter.delete('/:id', | 98 | videosRouter.delete('/:id', |
99 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo'), | ||
97 | authenticate, | 100 | authenticate, |
98 | asyncMiddleware(videosRemoveValidator), | 101 | asyncMiddleware(videosRemoveValidator), |
99 | asyncRetryTransactionMiddleware(removeVideo) | 102 | asyncRetryTransactionMiddleware(removeVideo) |
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 2450abd0e..09e584d30 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts | |||
@@ -20,6 +20,7 @@ import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | |||
20 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares' | 20 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares' |
21 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' | 21 | import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' |
22 | import { VideoModel } from '../../../models/video/video' | 22 | import { VideoModel } from '../../../models/video/video' |
23 | import { docMiddleware } from '@server/middlewares/doc' | ||
23 | 24 | ||
24 | const lTags = loggerTagsFactory('api', 'video') | 25 | const lTags = loggerTagsFactory('api', 'video') |
25 | const auditLogger = auditLoggerFactory('videos') | 26 | const auditLogger = auditLoggerFactory('videos') |
@@ -35,6 +36,7 @@ const reqVideoFileUpdate = createReqFiles( | |||
35 | ) | 36 | ) |
36 | 37 | ||
37 | updateRouter.put('/:id', | 38 | updateRouter.put('/:id', |
39 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/putVideo'), | ||
38 | authenticate, | 40 | authenticate, |
39 | reqVideoFileUpdate, | 41 | reqVideoFileUpdate, |
40 | asyncMiddleware(videosUpdateValidator), | 42 | asyncMiddleware(videosUpdateValidator), |
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), |