aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/video-channel.ts23
1 files changed, 16 insertions, 7 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index d1a1e6473..abb777e08 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -24,6 +24,7 @@ import {
24 asyncRetryTransactionMiddleware, 24 asyncRetryTransactionMiddleware,
25 authenticate, 25 authenticate,
26 commonVideosFiltersValidator, 26 commonVideosFiltersValidator,
27 ensureCanManageChannel,
27 optionalAuthenticate, 28 optionalAuthenticate,
28 paginationValidator, 29 paginationValidator,
29 setDefaultPagination, 30 setDefaultPagination,
@@ -36,7 +37,7 @@ import {
36 videoPlaylistsSortValidator 37 videoPlaylistsSortValidator
37} from '../../middlewares' 38} from '../../middlewares'
38import { 39import {
39 ensureAuthUserOwnsChannelValidator, 40 ensureIsLocalChannel,
40 videoChannelsFollowersSortValidator, 41 videoChannelsFollowersSortValidator,
41 videoChannelsListValidator, 42 videoChannelsListValidator,
42 videoChannelsNameWithHostValidator, 43 videoChannelsNameWithHostValidator,
@@ -74,7 +75,8 @@ videoChannelRouter.post('/:nameWithHost/avatar/pick',
74 authenticate, 75 authenticate,
75 reqAvatarFile, 76 reqAvatarFile,
76 asyncMiddleware(videoChannelsNameWithHostValidator), 77 asyncMiddleware(videoChannelsNameWithHostValidator),
77 ensureAuthUserOwnsChannelValidator, 78 ensureIsLocalChannel,
79 ensureCanManageChannel,
78 updateAvatarValidator, 80 updateAvatarValidator,
79 asyncMiddleware(updateVideoChannelAvatar) 81 asyncMiddleware(updateVideoChannelAvatar)
80) 82)
@@ -83,7 +85,8 @@ videoChannelRouter.post('/:nameWithHost/banner/pick',
83 authenticate, 85 authenticate,
84 reqBannerFile, 86 reqBannerFile,
85 asyncMiddleware(videoChannelsNameWithHostValidator), 87 asyncMiddleware(videoChannelsNameWithHostValidator),
86 ensureAuthUserOwnsChannelValidator, 88 ensureIsLocalChannel,
89 ensureCanManageChannel,
87 updateBannerValidator, 90 updateBannerValidator,
88 asyncMiddleware(updateVideoChannelBanner) 91 asyncMiddleware(updateVideoChannelBanner)
89) 92)
@@ -91,27 +94,33 @@ videoChannelRouter.post('/:nameWithHost/banner/pick',
91videoChannelRouter.delete('/:nameWithHost/avatar', 94videoChannelRouter.delete('/:nameWithHost/avatar',
92 authenticate, 95 authenticate,
93 asyncMiddleware(videoChannelsNameWithHostValidator), 96 asyncMiddleware(videoChannelsNameWithHostValidator),
94 ensureAuthUserOwnsChannelValidator, 97 ensureIsLocalChannel,
98 ensureCanManageChannel,
95 asyncMiddleware(deleteVideoChannelAvatar) 99 asyncMiddleware(deleteVideoChannelAvatar)
96) 100)
97 101
98videoChannelRouter.delete('/:nameWithHost/banner', 102videoChannelRouter.delete('/:nameWithHost/banner',
99 authenticate, 103 authenticate,
100 asyncMiddleware(videoChannelsNameWithHostValidator), 104 asyncMiddleware(videoChannelsNameWithHostValidator),
101 ensureAuthUserOwnsChannelValidator, 105 ensureIsLocalChannel,
106 ensureCanManageChannel,
102 asyncMiddleware(deleteVideoChannelBanner) 107 asyncMiddleware(deleteVideoChannelBanner)
103) 108)
104 109
105videoChannelRouter.put('/:nameWithHost', 110videoChannelRouter.put('/:nameWithHost',
106 authenticate, 111 authenticate,
107 asyncMiddleware(videoChannelsNameWithHostValidator), 112 asyncMiddleware(videoChannelsNameWithHostValidator),
108 ensureAuthUserOwnsChannelValidator, 113 ensureIsLocalChannel,
114 ensureCanManageChannel,
109 videoChannelsUpdateValidator, 115 videoChannelsUpdateValidator,
110 asyncRetryTransactionMiddleware(updateVideoChannel) 116 asyncRetryTransactionMiddleware(updateVideoChannel)
111) 117)
112 118
113videoChannelRouter.delete('/:nameWithHost', 119videoChannelRouter.delete('/:nameWithHost',
114 authenticate, 120 authenticate,
121 asyncMiddleware(videoChannelsNameWithHostValidator),
122 ensureIsLocalChannel,
123 ensureCanManageChannel,
115 asyncMiddleware(videoChannelsRemoveValidator), 124 asyncMiddleware(videoChannelsRemoveValidator),
116 asyncRetryTransactionMiddleware(removeVideoChannel) 125 asyncRetryTransactionMiddleware(removeVideoChannel)
117) 126)
@@ -145,7 +154,7 @@ videoChannelRouter.get('/:nameWithHost/videos',
145videoChannelRouter.get('/:nameWithHost/followers', 154videoChannelRouter.get('/:nameWithHost/followers',
146 authenticate, 155 authenticate,
147 asyncMiddleware(videoChannelsNameWithHostValidator), 156 asyncMiddleware(videoChannelsNameWithHostValidator),
148 ensureAuthUserOwnsChannelValidator, 157 ensureCanManageChannel,
149 paginationValidator, 158 paginationValidator,
150 videoChannelsFollowersSortValidator, 159 videoChannelsFollowersSortValidator,
151 setDefaultSort, 160 setDefaultSort,