diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 112 |
1 files changed, 67 insertions, 45 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index f1217f6db..cc2671fc1 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -45,97 +45,119 @@ import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/vid | |||
45 | const activityPubClientRouter = express.Router() | 45 | const activityPubClientRouter = express.Router() |
46 | 46 | ||
47 | activityPubClientRouter.get('/accounts?/:name', | 47 | activityPubClientRouter.get('/accounts?/:name', |
48 | executeIfActivityPub(asyncMiddleware(localAccountValidator)), | 48 | executeIfActivityPub, |
49 | executeIfActivityPub(accountController) | 49 | asyncMiddleware(localAccountValidator), |
50 | accountController | ||
50 | ) | 51 | ) |
51 | activityPubClientRouter.get('/accounts?/:name/followers', | 52 | activityPubClientRouter.get('/accounts?/:name/followers', |
52 | executeIfActivityPub(asyncMiddleware(localAccountValidator)), | 53 | executeIfActivityPub, |
53 | executeIfActivityPub(asyncMiddleware(accountFollowersController)) | 54 | asyncMiddleware(localAccountValidator), |
55 | asyncMiddleware(accountFollowersController) | ||
54 | ) | 56 | ) |
55 | activityPubClientRouter.get('/accounts?/:name/following', | 57 | activityPubClientRouter.get('/accounts?/:name/following', |
56 | executeIfActivityPub(asyncMiddleware(localAccountValidator)), | 58 | executeIfActivityPub, |
57 | executeIfActivityPub(asyncMiddleware(accountFollowingController)) | 59 | asyncMiddleware(localAccountValidator), |
60 | asyncMiddleware(accountFollowingController) | ||
58 | ) | 61 | ) |
59 | activityPubClientRouter.get('/accounts?/:name/playlists', | 62 | activityPubClientRouter.get('/accounts?/:name/playlists', |
60 | executeIfActivityPub(asyncMiddleware(localAccountValidator)), | 63 | executeIfActivityPub, |
61 | executeIfActivityPub(asyncMiddleware(accountPlaylistsController)) | 64 | asyncMiddleware(localAccountValidator), |
65 | asyncMiddleware(accountPlaylistsController) | ||
62 | ) | 66 | ) |
63 | activityPubClientRouter.get('/accounts?/:name/likes/:videoId', | 67 | activityPubClientRouter.get('/accounts?/:name/likes/:videoId', |
64 | executeIfActivityPub(asyncMiddleware(getAccountVideoRateValidator('like'))), | 68 | executeIfActivityPub, |
65 | executeIfActivityPub(getAccountVideoRate('like')) | 69 | asyncMiddleware(getAccountVideoRateValidator('like')), |
70 | getAccountVideoRate('like') | ||
66 | ) | 71 | ) |
67 | activityPubClientRouter.get('/accounts?/:name/dislikes/:videoId', | 72 | activityPubClientRouter.get('/accounts?/:name/dislikes/:videoId', |
68 | executeIfActivityPub(asyncMiddleware(getAccountVideoRateValidator('dislike'))), | 73 | executeIfActivityPub, |
69 | executeIfActivityPub(getAccountVideoRate('dislike')) | 74 | asyncMiddleware(getAccountVideoRateValidator('dislike')), |
75 | getAccountVideoRate('dislike') | ||
70 | ) | 76 | ) |
71 | 77 | ||
72 | activityPubClientRouter.get('/videos/watch/:id', | 78 | activityPubClientRouter.get('/videos/watch/:id', |
73 | executeIfActivityPub(asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))), | 79 | executeIfActivityPub, |
74 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video-with-rights'))), | 80 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS)), |
75 | executeIfActivityPub(asyncMiddleware(videoController)) | 81 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), |
82 | asyncMiddleware(videoController) | ||
76 | ) | 83 | ) |
77 | activityPubClientRouter.get('/videos/watch/:id/activity', | 84 | activityPubClientRouter.get('/videos/watch/:id/activity', |
78 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video-with-rights'))), | 85 | executeIfActivityPub, |
79 | executeIfActivityPub(asyncMiddleware(videoController)) | 86 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), |
87 | asyncMiddleware(videoController) | ||
80 | ) | 88 | ) |
81 | activityPubClientRouter.get('/videos/watch/:id/announces', | 89 | activityPubClientRouter.get('/videos/watch/:id/announces', |
82 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), | 90 | executeIfActivityPub, |
83 | executeIfActivityPub(asyncMiddleware(videoAnnouncesController)) | 91 | asyncMiddleware(videosCustomGetValidator('only-video')), |
92 | asyncMiddleware(videoAnnouncesController) | ||
84 | ) | 93 | ) |
85 | activityPubClientRouter.get('/videos/watch/:id/announces/:actorId', | 94 | activityPubClientRouter.get('/videos/watch/:id/announces/:actorId', |
86 | executeIfActivityPub(asyncMiddleware(videosShareValidator)), | 95 | executeIfActivityPub, |
87 | executeIfActivityPub(asyncMiddleware(videoAnnounceController)) | 96 | asyncMiddleware(videosShareValidator), |
97 | asyncMiddleware(videoAnnounceController) | ||
88 | ) | 98 | ) |
89 | activityPubClientRouter.get('/videos/watch/:id/likes', | 99 | activityPubClientRouter.get('/videos/watch/:id/likes', |
90 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), | 100 | executeIfActivityPub, |
91 | executeIfActivityPub(asyncMiddleware(videoLikesController)) | 101 | asyncMiddleware(videosCustomGetValidator('only-video')), |
102 | asyncMiddleware(videoLikesController) | ||
92 | ) | 103 | ) |
93 | activityPubClientRouter.get('/videos/watch/:id/dislikes', | 104 | activityPubClientRouter.get('/videos/watch/:id/dislikes', |
94 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), | 105 | executeIfActivityPub, |
95 | executeIfActivityPub(asyncMiddleware(videoDislikesController)) | 106 | asyncMiddleware(videosCustomGetValidator('only-video')), |
107 | asyncMiddleware(videoDislikesController) | ||
96 | ) | 108 | ) |
97 | activityPubClientRouter.get('/videos/watch/:id/comments', | 109 | activityPubClientRouter.get('/videos/watch/:id/comments', |
98 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), | 110 | executeIfActivityPub, |
99 | executeIfActivityPub(asyncMiddleware(videoCommentsController)) | 111 | asyncMiddleware(videosCustomGetValidator('only-video')), |
112 | asyncMiddleware(videoCommentsController) | ||
100 | ) | 113 | ) |
101 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', | 114 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', |
102 | executeIfActivityPub(asyncMiddleware(videoCommentGetValidator)), | 115 | executeIfActivityPub, |
103 | executeIfActivityPub(asyncMiddleware(videoCommentController)) | 116 | asyncMiddleware(videoCommentGetValidator), |
117 | asyncMiddleware(videoCommentController) | ||
104 | ) | 118 | ) |
105 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId/activity', | 119 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId/activity', |
106 | executeIfActivityPub(asyncMiddleware(videoCommentGetValidator)), | 120 | executeIfActivityPub, |
107 | executeIfActivityPub(asyncMiddleware(videoCommentController)) | 121 | asyncMiddleware(videoCommentGetValidator), |
122 | asyncMiddleware(videoCommentController) | ||
108 | ) | 123 | ) |
109 | 124 | ||
110 | activityPubClientRouter.get('/video-channels/:name', | 125 | activityPubClientRouter.get('/video-channels/:name', |
111 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), | 126 | executeIfActivityPub, |
112 | executeIfActivityPub(asyncMiddleware(videoChannelController)) | 127 | asyncMiddleware(localVideoChannelValidator), |
128 | asyncMiddleware(videoChannelController) | ||
113 | ) | 129 | ) |
114 | activityPubClientRouter.get('/video-channels/:name/followers', | 130 | activityPubClientRouter.get('/video-channels/:name/followers', |
115 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), | 131 | executeIfActivityPub, |
116 | executeIfActivityPub(asyncMiddleware(videoChannelFollowersController)) | 132 | asyncMiddleware(localVideoChannelValidator), |
133 | asyncMiddleware(videoChannelFollowersController) | ||
117 | ) | 134 | ) |
118 | activityPubClientRouter.get('/video-channels/:name/following', | 135 | activityPubClientRouter.get('/video-channels/:name/following', |
119 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), | 136 | executeIfActivityPub, |
120 | executeIfActivityPub(asyncMiddleware(videoChannelFollowingController)) | 137 | asyncMiddleware(localVideoChannelValidator), |
138 | asyncMiddleware(videoChannelFollowingController) | ||
121 | ) | 139 | ) |
122 | 140 | ||
123 | activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?', | 141 | activityPubClientRouter.get('/redundancy/videos/:videoId/:resolution([0-9]+)(-:fps([0-9]+))?', |
124 | executeIfActivityPub(asyncMiddleware(videoFileRedundancyGetValidator)), | 142 | executeIfActivityPub, |
125 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) | 143 | asyncMiddleware(videoFileRedundancyGetValidator), |
144 | asyncMiddleware(videoRedundancyController) | ||
126 | ) | 145 | ) |
127 | activityPubClientRouter.get('/redundancy/streaming-playlists/:streamingPlaylistType/:videoId', | 146 | activityPubClientRouter.get('/redundancy/streaming-playlists/:streamingPlaylistType/:videoId', |
128 | executeIfActivityPub(asyncMiddleware(videoPlaylistRedundancyGetValidator)), | 147 | executeIfActivityPub, |
129 | executeIfActivityPub(asyncMiddleware(videoRedundancyController)) | 148 | asyncMiddleware(videoPlaylistRedundancyGetValidator), |
149 | asyncMiddleware(videoRedundancyController) | ||
130 | ) | 150 | ) |
131 | 151 | ||
132 | activityPubClientRouter.get('/video-playlists/:playlistId', | 152 | activityPubClientRouter.get('/video-playlists/:playlistId', |
133 | executeIfActivityPub(asyncMiddleware(videoPlaylistsGetValidator)), | 153 | executeIfActivityPub, |
134 | executeIfActivityPub(asyncMiddleware(videoPlaylistController)) | 154 | asyncMiddleware(videoPlaylistsGetValidator), |
155 | asyncMiddleware(videoPlaylistController) | ||
135 | ) | 156 | ) |
136 | activityPubClientRouter.get('/video-playlists/:playlistId/:videoId', | 157 | activityPubClientRouter.get('/video-playlists/:playlistId/:videoId', |
137 | executeIfActivityPub(asyncMiddleware(videoPlaylistElementAPGetValidator)), | 158 | executeIfActivityPub, |
138 | executeIfActivityPub(asyncMiddleware(videoPlaylistElementController)) | 159 | asyncMiddleware(videoPlaylistElementAPGetValidator), |
160 | asyncMiddleware(videoPlaylistElementController) | ||
139 | ) | 161 | ) |
140 | 162 | ||
141 | // --------------------------------------------------------------------------- | 163 | // --------------------------------------------------------------------------- |