aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 10:16:44 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 10:20:38 +0200
commit96f29c0f6d2e623fb088e88200934c5df8da9924 (patch)
treef11e52c12f56733bef70ac7bbde5179c5a5ecc40 /server/controllers
parentad76628b17ff8f25d3402d6d669b274116bbf76c (diff)
downloadPeerTube-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.ts16
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'
6import { buildAnnounceWithVideoAudience } from '../../lib/activitypub/send' 6import { buildAnnounceWithVideoAudience } from '../../lib/activitypub/send'
7import { audiencify, getAudience } from '../../lib/activitypub/audience' 7import { audiencify, getAudience } from '../../lib/activitypub/audience'
8import { buildCreateActivity } from '../../lib/activitypub/send/send-create' 8import { buildCreateActivity } from '../../lib/activitypub/send/send-create'
9import { asyncMiddleware, executeIfActivityPub, localAccountValidator, localVideoChannelValidator } from '../../middlewares' 9import {
10 asyncMiddleware,
11 executeIfActivityPub,
12 localAccountValidator,
13 localVideoChannelValidator,
14 videosCustomGetValidator
15} from '../../middlewares'
10import { videosGetValidator, videosShareValidator } from '../../middlewares/validators' 16import { videosGetValidator, videosShareValidator } from '../../middlewares/validators'
11import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' 17import { videoCommentGetValidator } from '../../middlewares/validators/video-comments'
12import { AccountModel } from '../../models/account/account' 18import { 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)
56activityPubClientRouter.get('/videos/watch/:id/announces', 62activityPubClientRouter.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)
60activityPubClientRouter.get('/videos/watch/:id/announces/:accountId', 66activityPubClientRouter.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)
64activityPubClientRouter.get('/videos/watch/:id/likes', 70activityPubClientRouter.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)
68activityPubClientRouter.get('/videos/watch/:id/dislikes', 74activityPubClientRouter.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)
72activityPubClientRouter.get('/videos/watch/:id/comments', 78activityPubClientRouter.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)
76activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId', 82activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId',