mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Move apicache in peertube
Allow us to upgrade to node 16
This commit is contained in:
parent
13e1337791
commit
20bafcb61b
15 changed files with 372 additions and 65 deletions
|
@ -19,7 +19,7 @@ import {
|
|||
} from '../initializers/constants'
|
||||
import { getThemeOrDefault } from '../lib/plugins/theme-utils'
|
||||
import { asyncMiddleware } from '../middlewares'
|
||||
import { cacheRoute } from '../middlewares/cache'
|
||||
import { cacheRoute } from '../middlewares/cache/cache'
|
||||
import { UserModel } from '../models/user/user'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
|
@ -66,7 +66,7 @@ staticRouter.use(
|
|||
|
||||
// robots.txt service
|
||||
staticRouter.get('/robots.txt',
|
||||
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.ROBOTS)),
|
||||
cacheRoute(ROUTE_CACHE_LIFETIME.ROBOTS),
|
||||
(_, res: express.Response) => {
|
||||
res.type('text/plain')
|
||||
return res.send(CONFIG.INSTANCE.ROBOTS)
|
||||
|
@ -86,7 +86,7 @@ staticRouter.get('/security.txt',
|
|||
)
|
||||
|
||||
staticRouter.get('/.well-known/security.txt',
|
||||
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.SECURITYTXT)),
|
||||
cacheRoute(ROUTE_CACHE_LIFETIME.SECURITYTXT),
|
||||
(_, res: express.Response) => {
|
||||
res.type('text/plain')
|
||||
return res.send(CONFIG.INSTANCE.SECURITYTXT + CONFIG.INSTANCE.SECURITYTXT_CONTACT)
|
||||
|
@ -95,7 +95,7 @@ staticRouter.get('/.well-known/security.txt',
|
|||
|
||||
// nodeinfo service
|
||||
staticRouter.use('/.well-known/nodeinfo',
|
||||
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.NODEINFO)),
|
||||
cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO),
|
||||
(_, res: express.Response) => {
|
||||
return res.json({
|
||||
links: [
|
||||
|
@ -108,13 +108,13 @@ staticRouter.use('/.well-known/nodeinfo',
|
|||
}
|
||||
)
|
||||
staticRouter.use('/nodeinfo/:version.json',
|
||||
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.NODEINFO)),
|
||||
cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO),
|
||||
asyncMiddleware(generateNodeinfo)
|
||||
)
|
||||
|
||||
// dnt-policy.txt service (see https://www.eff.org/dnt-policy)
|
||||
staticRouter.use('/.well-known/dnt-policy.txt',
|
||||
asyncMiddleware(cacheRoute()(ROUTE_CACHE_LIFETIME.DNT_POLICY)),
|
||||
cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY),
|
||||
(_, res: express.Response) => {
|
||||
res.type('text/plain')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue