diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 4 | ||||
-rw-r--r-- | server/controllers/feeds.ts | 6 | ||||
-rw-r--r-- | server/controllers/static.ts | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index ebb2c06a2..c90c3f931 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -16,7 +16,7 @@ import { VideoModel } from '../../models/video/video' | |||
16 | import { VideoChannelModel } from '../../models/video/video-channel' | 16 | import { VideoChannelModel } from '../../models/video/video-channel' |
17 | import { VideoCommentModel } from '../../models/video/video-comment' | 17 | import { VideoCommentModel } from '../../models/video/video-comment' |
18 | import { VideoShareModel } from '../../models/video/video-share' | 18 | import { VideoShareModel } from '../../models/video/video-share' |
19 | import { cache } from '../../middlewares/cache' | 19 | import { cacheRoute } from '../../middlewares/cache' |
20 | import { activityPubResponse } from './utils' | 20 | import { activityPubResponse } from './utils' |
21 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' | 21 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' |
22 | import { | 22 | import { |
@@ -43,7 +43,7 @@ activityPubClientRouter.get('/accounts?/:name/following', | |||
43 | ) | 43 | ) |
44 | 44 | ||
45 | activityPubClientRouter.get('/videos/watch/:id', | 45 | activityPubClientRouter.get('/videos/watch/:id', |
46 | executeIfActivityPub(asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))), | 46 | executeIfActivityPub(asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ACTIVITY_PUB.VIDEOS))), |
47 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), | 47 | executeIfActivityPub(asyncMiddleware(videosGetValidator)), |
48 | executeIfActivityPub(asyncMiddleware(videoController)) | 48 | executeIfActivityPub(asyncMiddleware(videoController)) |
49 | ) | 49 | ) |
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 6cbe42a2a..682f4abda 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -5,7 +5,7 @@ import { asyncMiddleware, setDefaultSort, videoCommentsFeedsValidator, videoFeed | |||
5 | import { VideoModel } from '../models/video/video' | 5 | import { VideoModel } from '../models/video/video' |
6 | import * as Feed from 'pfeed' | 6 | import * as Feed from 'pfeed' |
7 | import { AccountModel } from '../models/account/account' | 7 | import { AccountModel } from '../models/account/account' |
8 | import { cache } from '../middlewares/cache' | 8 | import { cacheRoute } from '../middlewares/cache' |
9 | import { VideoChannelModel } from '../models/video/video-channel' | 9 | import { VideoChannelModel } from '../models/video/video-channel' |
10 | import { VideoCommentModel } from '../models/video/video-comment' | 10 | import { VideoCommentModel } from '../models/video/video-comment' |
11 | import { buildNSFWFilter } from '../helpers/express-utils' | 11 | import { buildNSFWFilter } from '../helpers/express-utils' |
@@ -13,7 +13,7 @@ import { buildNSFWFilter } from '../helpers/express-utils' | |||
13 | const feedsRouter = express.Router() | 13 | const feedsRouter = express.Router() |
14 | 14 | ||
15 | feedsRouter.get('/feeds/video-comments.:format', | 15 | feedsRouter.get('/feeds/video-comments.:format', |
16 | asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.FEEDS)), | 16 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)), |
17 | asyncMiddleware(videoCommentsFeedsValidator), | 17 | asyncMiddleware(videoCommentsFeedsValidator), |
18 | asyncMiddleware(generateVideoCommentsFeed) | 18 | asyncMiddleware(generateVideoCommentsFeed) |
19 | ) | 19 | ) |
@@ -21,7 +21,7 @@ feedsRouter.get('/feeds/video-comments.:format', | |||
21 | feedsRouter.get('/feeds/videos.:format', | 21 | feedsRouter.get('/feeds/videos.:format', |
22 | videosSortValidator, | 22 | videosSortValidator, |
23 | setDefaultSort, | 23 | setDefaultSort, |
24 | asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.FEEDS)), | 24 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.FEEDS)), |
25 | asyncMiddleware(videoFeedsValidator), | 25 | asyncMiddleware(videoFeedsValidator), |
26 | asyncMiddleware(generateVideoFeed) | 26 | asyncMiddleware(generateVideoFeed) |
27 | ) | 27 | ) |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index ce5d0c5fa..f10427f3e 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -2,7 +2,7 @@ import * as cors from 'cors' | |||
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' | 3 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' |
4 | import { VideosPreviewCache } from '../lib/cache' | 4 | import { VideosPreviewCache } from '../lib/cache' |
5 | import { cache } from '../middlewares/cache' | 5 | import { cacheRoute } from '../middlewares/cache' |
6 | import { asyncMiddleware, videosGetValidator } from '../middlewares' | 6 | import { asyncMiddleware, videosGetValidator } from '../middlewares' |
7 | import { VideoModel } from '../models/video/video' | 7 | import { VideoModel } from '../models/video/video' |
8 | import { VideosCaptionCache } from '../lib/cache/videos-caption-cache' | 8 | import { VideosCaptionCache } from '../lib/cache/videos-caption-cache' |
@@ -71,7 +71,7 @@ staticRouter.use( | |||
71 | 71 | ||
72 | // robots.txt service | 72 | // robots.txt service |
73 | staticRouter.get('/robots.txt', | 73 | staticRouter.get('/robots.txt', |
74 | asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.ROBOTS)), | 74 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS)), |
75 | (_, res: express.Response) => { | 75 | (_, res: express.Response) => { |
76 | res.type('text/plain') | 76 | res.type('text/plain') |
77 | return res.send(CONFIG.INSTANCE.ROBOTS) | 77 | return res.send(CONFIG.INSTANCE.ROBOTS) |
@@ -80,7 +80,7 @@ staticRouter.get('/robots.txt', | |||
80 | 80 | ||
81 | // nodeinfo service | 81 | // nodeinfo service |
82 | staticRouter.use('/.well-known/nodeinfo', | 82 | staticRouter.use('/.well-known/nodeinfo', |
83 | asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.NODEINFO)), | 83 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)), |
84 | (_, res: express.Response) => { | 84 | (_, res: express.Response) => { |
85 | return res.json({ | 85 | return res.json({ |
86 | links: [ | 86 | links: [ |
@@ -93,7 +93,7 @@ staticRouter.use('/.well-known/nodeinfo', | |||
93 | } | 93 | } |
94 | ) | 94 | ) |
95 | staticRouter.use('/nodeinfo/:version.json', | 95 | staticRouter.use('/nodeinfo/:version.json', |
96 | asyncMiddleware(cache(ROUTE_CACHE_LIFETIME.NODEINFO)), | 96 | // asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)), |
97 | asyncMiddleware(generateNodeinfo) | 97 | asyncMiddleware(generateNodeinfo) |
98 | ) | 98 | ) |
99 | 99 | ||
@@ -161,13 +161,13 @@ async function generateNodeinfo (req: express.Request, res: express.Response, ne | |||
161 | nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION | 161 | nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION |
162 | } | 162 | } |
163 | } as HttpNodeinfoDiasporaSoftwareNsSchema20 | 163 | } as HttpNodeinfoDiasporaSoftwareNsSchema20 |
164 | res.set('Content-Type', 'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8') | 164 | res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"') |
165 | } else { | 165 | } else { |
166 | json = { error: 'Nodeinfo schema version not handled' } | 166 | json = { error: 'Nodeinfo schema version not handled' } |
167 | res.status(404) | 167 | res.status(404) |
168 | } | 168 | } |
169 | 169 | ||
170 | return res.end(JSON.stringify(json)) | 170 | return res.send(json).end() |
171 | } | 171 | } |
172 | 172 | ||
173 | async function downloadTorrent (req: express.Request, res: express.Response, next: express.NextFunction) { | 173 | async function downloadTorrent (req: express.Request, res: express.Response, next: express.NextFunction) { |