aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-11 09:44:04 +0200
committerChocobozzz <me@florianbigard.com>2018-05-11 15:24:17 +0200
commitfd4484f19eae8b0a0c30d5d30e98880c8708516a (patch)
tree9dcb357413c84797b79e301fb843b1695e20d902 /server/controllers/activitypub
parent8a2db2e8cb67f7f802ecb35be7b9154695f1a6ec (diff)
downloadPeerTube-fd4484f19eae8b0a0c30d5d30e98880c8708516a.tar.gz
PeerTube-fd4484f19eae8b0a0c30d5d30e98880c8708516a.tar.zst
PeerTube-fd4484f19eae8b0a0c30d5d30e98880c8708516a.zip
Cache AP video route for 5 seconds
Diffstat (limited to 'server/controllers/activitypub')
-rw-r--r--server/controllers/activitypub/client.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index f5ac9c466..5199b3f81 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -3,7 +3,7 @@ import * as express from 'express'
3import { VideoPrivacy } from '../../../shared/models/videos' 3import { VideoPrivacy } from '../../../shared/models/videos'
4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' 4import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
5import { pageToStartAndCount } from '../../helpers/core-utils' 5import { pageToStartAndCount } from '../../helpers/core-utils'
6import { ACTIVITY_PUB, CONFIG } from '../../initializers' 6import { ACTIVITY_PUB, CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers'
7import { buildVideoAnnounce } from '../../lib/activitypub/send' 7import { buildVideoAnnounce } from '../../lib/activitypub/send'
8import { audiencify, getAudience } from '../../lib/activitypub/send/misc' 8import { audiencify, getAudience } from '../../lib/activitypub/send/misc'
9import { createActivityData } from '../../lib/activitypub/send/send-create' 9import { createActivityData } from '../../lib/activitypub/send/send-create'
@@ -17,6 +17,7 @@ import { VideoModel } from '../../models/video/video'
17import { VideoChannelModel } from '../../models/video/video-channel' 17import { VideoChannelModel } from '../../models/video/video-channel'
18import { VideoCommentModel } from '../../models/video/video-comment' 18import { VideoCommentModel } from '../../models/video/video-comment'
19import { VideoShareModel } from '../../models/video/video-share' 19import { VideoShareModel } from '../../models/video/video-share'
20import { cacheRoute } from '../../middlewares/cache'
20 21
21const activityPubClientRouter = express.Router() 22const activityPubClientRouter = express.Router()
22 23
@@ -34,6 +35,7 @@ activityPubClientRouter.get('/accounts?/:name/following',
34) 35)
35 36
36activityPubClientRouter.get('/videos/watch/:id', 37activityPubClientRouter.get('/videos/watch/:id',
38 executeIfActivityPub(asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))),
37 executeIfActivityPub(asyncMiddleware(videosGetValidator)), 39 executeIfActivityPub(asyncMiddleware(videosGetValidator)),
38 executeIfActivityPub(asyncMiddleware(videoController)) 40 executeIfActivityPub(asyncMiddleware(videoController))
39) 41)