aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2021-06-04 08:57:07 +0200
committerRigel Kent <sendmemail@rigelk.eu>2021-06-04 09:21:46 +0200
commit1c627fd8d2e60d4d790353886006485343d70084 (patch)
tree384fcd80a018eab2ace2a340d028b23359c07dc7 /server/controllers
parentb96d21b744f3b0714636bd43e7f39fb33c3adb73 (diff)
downloadPeerTube-1c627fd8d2e60d4d790353886006485343d70084.tar.gz
PeerTube-1c627fd8d2e60d4d790353886006485343d70084.tar.zst
PeerTube-1c627fd8d2e60d4d790353886006485343d70084.zip
refactor docMiddleware to support operationId-only form
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/index.ts6
-rw-r--r--server/controllers/api/videos/update.ts4
-rw-r--r--server/controllers/api/videos/upload.ts8
3 files changed, 9 insertions, 9 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 7671f099e..703051ee2 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import toInt from 'validator/lib/toInt' 2import toInt from 'validator/lib/toInt'
3import { doJSONRequest } from '@server/helpers/requests' 3import { doJSONRequest } from '@server/helpers/requests'
4import { LiveManager } from '@server/lib/live-manager' 4import { LiveManager } from '@server/lib/live-manager'
5import { docMiddleware } from '@server/middlewares/doc' 5import { openapiOperationDoc } from '@server/middlewares/doc'
6import { getServerActor } from '@server/models/application/application' 6import { getServerActor } from '@server/models/application/application'
7import { MVideoAccountLight } from '@server/types/models' 7import { MVideoAccountLight } from '@server/types/models'
8import { VideosCommonQuery } from '../../../../shared' 8import { VideosCommonQuery } from '../../../../shared'
@@ -84,7 +84,7 @@ videosRouter.get('/:id/metadata/:videoFileId',
84 asyncMiddleware(getVideoFileMetadata) 84 asyncMiddleware(getVideoFileMetadata)
85) 85)
86videosRouter.get('/:id', 86videosRouter.get('/:id',
87 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo'), 87 openapiOperationDoc({ operationId: 'getVideo' }),
88 optionalAuthenticate, 88 optionalAuthenticate,
89 asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), 89 asyncMiddleware(videosCustomGetValidator('only-video-with-rights')),
90 asyncMiddleware(checkVideoFollowConstraints), 90 asyncMiddleware(checkVideoFollowConstraints),
@@ -96,7 +96,7 @@ videosRouter.post('/:id/views',
96) 96)
97 97
98videosRouter.delete('/:id', 98videosRouter.delete('/:id',
99 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo'), 99 openapiOperationDoc({ operationId: 'delVideo' }),
100 authenticate, 100 authenticate,
101 asyncMiddleware(videosRemoveValidator), 101 asyncMiddleware(videosRemoveValidator),
102 asyncRetryTransactionMiddleware(removeVideo) 102 asyncRetryTransactionMiddleware(removeVideo)
diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts
index 09e584d30..8affe71c6 100644
--- a/server/controllers/api/videos/update.ts
+++ b/server/controllers/api/videos/update.ts
@@ -20,7 +20,7 @@ import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
20import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares' 20import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videosUpdateValidator } from '../../../middlewares'
21import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' 21import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
22import { VideoModel } from '../../../models/video/video' 22import { VideoModel } from '../../../models/video/video'
23import { docMiddleware } from '@server/middlewares/doc' 23import { openapiOperationDoc } from '@server/middlewares/doc'
24 24
25const lTags = loggerTagsFactory('api', 'video') 25const lTags = loggerTagsFactory('api', 'video')
26const auditLogger = auditLoggerFactory('videos') 26const auditLogger = auditLoggerFactory('videos')
@@ -36,7 +36,7 @@ const reqVideoFileUpdate = createReqFiles(
36) 36)
37 37
38updateRouter.put('/:id', 38updateRouter.put('/:id',
39 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/putVideo'), 39 openapiOperationDoc({ operationId: 'putVideo' }),
40 authenticate, 40 authenticate,
41 reqVideoFileUpdate, 41 reqVideoFileUpdate,
42 asyncMiddleware(videosUpdateValidator), 42 asyncMiddleware(videosUpdateValidator),
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts
index 93a68f759..783cc329a 100644
--- a/server/controllers/api/videos/upload.ts
+++ b/server/controllers/api/videos/upload.ts
@@ -6,7 +6,7 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
6import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 6import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
7import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' 7import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
8import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' 8import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
9import { docMiddleware } from '@server/middlewares/doc' 9import { openapiOperationDoc } from '@server/middlewares/doc'
10import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 10import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
11import { uploadx } from '@uploadx/core' 11import { uploadx } from '@uploadx/core'
12import { VideoCreate, VideoState } from '../../../../shared' 12import { VideoCreate, VideoState } from '../../../../shared'
@@ -61,7 +61,7 @@ const reqVideoFileAddResumable = createReqFiles(
61) 61)
62 62
63uploadRouter.post('/upload', 63uploadRouter.post('/upload',
64 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadLegacy'), 64 openapiOperationDoc({ operationId: 'uploadLegacy' }),
65 authenticate, 65 authenticate,
66 reqVideoFileAdd, 66 reqVideoFileAdd,
67 asyncMiddleware(videosAddLegacyValidator), 67 asyncMiddleware(videosAddLegacyValidator),
@@ -69,7 +69,7 @@ uploadRouter.post('/upload',
69) 69)
70 70
71uploadRouter.post('/upload-resumable', 71uploadRouter.post('/upload-resumable',
72 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumableInit'), 72 openapiOperationDoc({ operationId: 'uploadResumableInit' }),
73 authenticate, 73 authenticate,
74 reqVideoFileAddResumable, 74 reqVideoFileAddResumable,
75 asyncMiddleware(videosAddResumableInitValidator), 75 asyncMiddleware(videosAddResumableInitValidator),
@@ -82,7 +82,7 @@ uploadRouter.delete('/upload-resumable',
82) 82)
83 83
84uploadRouter.put('/upload-resumable', 84uploadRouter.put('/upload-resumable',
85 docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/uploadResumable'), 85 openapiOperationDoc({ operationId: 'uploadResumable' }),
86 authenticate, 86 authenticate,
87 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
88 asyncMiddleware(videosAddResumableValidator), 88 asyncMiddleware(videosAddResumableValidator),