diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-19 10:16:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 10:20:38 +0200 |
commit | 96f29c0f6d2e623fb088e88200934c5df8da9924 (patch) | |
tree | f11e52c12f56733bef70ac7bbde5179c5a5ecc40 /server/controllers | |
parent | ad76628b17ff8f25d3402d6d669b274116bbf76c (diff) | |
download | PeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.tar.gz PeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.tar.zst PeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.zip |
Optimize SQL requests of videos AP endpoints
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index 2e168ea78..6229c44aa 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -6,7 +6,13 @@ import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' | |||
6 | import { buildAnnounceWithVideoAudience } from '../../lib/activitypub/send' | 6 | import { buildAnnounceWithVideoAudience } from '../../lib/activitypub/send' |
7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' | 7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' |
8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' | 8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' |
9 | import { asyncMiddleware, executeIfActivityPub, localAccountValidator, localVideoChannelValidator } from '../../middlewares' | 9 | import { |
10 | asyncMiddleware, | ||
11 | executeIfActivityPub, | ||
12 | localAccountValidator, | ||
13 | localVideoChannelValidator, | ||
14 | videosCustomGetValidator | ||
15 | } from '../../middlewares' | ||
10 | import { videosGetValidator, videosShareValidator } from '../../middlewares/validators' | 16 | import { videosGetValidator, videosShareValidator } from '../../middlewares/validators' |
11 | import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' | 17 | import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' |
12 | import { AccountModel } from '../../models/account/account' | 18 | import { AccountModel } from '../../models/account/account' |
@@ -54,7 +60,7 @@ activityPubClientRouter.get('/videos/watch/:id/activity', | |||
54 | executeIfActivityPub(asyncMiddleware(videoController)) | 60 | executeIfActivityPub(asyncMiddleware(videoController)) |
55 | ) | 61 | ) |
56 | activityPubClientRouter.get('/videos/watch/:id/announces', | 62 | activityPubClientRouter.get('/videos/watch/:id/announces', |
57 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 63 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), |
58 | executeIfActivityPub(asyncMiddleware(videoAnnouncesController)) | 64 | executeIfActivityPub(asyncMiddleware(videoAnnouncesController)) |
59 | ) | 65 | ) |
60 | activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', | 66 | activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', |
@@ -62,15 +68,15 @@ activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', | |||
62 | executeIfActivityPub(asyncMiddleware(videoAnnounceController)) | 68 | executeIfActivityPub(asyncMiddleware(videoAnnounceController)) |
63 | ) | 69 | ) |
64 | activityPubClientRouter.get('/videos/watch/:id/likes', | 70 | activityPubClientRouter.get('/videos/watch/:id/likes', |
65 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 71 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), |
66 | executeIfActivityPub(asyncMiddleware(videoLikesController)) | 72 | executeIfActivityPub(asyncMiddleware(videoLikesController)) |
67 | ) | 73 | ) |
68 | activityPubClientRouter.get('/videos/watch/:id/dislikes', | 74 | activityPubClientRouter.get('/videos/watch/:id/dislikes', |
69 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 75 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), |
70 | executeIfActivityPub(asyncMiddleware(videoDislikesController)) | 76 | executeIfActivityPub(asyncMiddleware(videoDislikesController)) |
71 | ) | 77 | ) |
72 | activityPubClientRouter.get('/videos/watch/:id/comments', | 78 | activityPubClientRouter.get('/videos/watch/:id/comments', |
73 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 79 | executeIfActivityPub(asyncMiddleware(videosCustomGetValidator('only-video'))), |
74 | executeIfActivityPub(asyncMiddleware(videoCommentsController)) | 80 | executeIfActivityPub(asyncMiddleware(videoCommentsController)) |
75 | ) | 81 | ) |
76 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', | 82 | activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', |