X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.ts;h=a6052faed37220501cf120d5ea8e53dc2e5ea6ae;hb=f4001cf408a99049d01a356bfb20a62342de06ea;hp=5511c5435856fec72698f20295fa35e754d44267;hpb=12daa83784ea112e33d3b8b590a805dae9a29c1c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index 5511c5435..a6052faed 100644 --- a/server.ts +++ b/server.ts @@ -1,4 +1,6 @@ // FIXME: https://github.com/nodejs/node/pull/16853 +import { VideosCaptionCache } from './server/lib/cache/videos-caption-cache' + require('tls').DEFAULT_ECDH_CURVE = 'auto' import { isTestInstance } from './server/helpers/core-utils' @@ -24,7 +26,7 @@ import { checkMissedConfig, checkFFmpeg, checkConfig, checkActivityPubUrls } fro // Do not use barrels because we don't want to load all modules here (we need to initialize database first) import { logger } from './server/helpers/logger' -import { API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' +import { API_VERSION, CONFIG, STATIC_PATHS, CACHE } from './server/initializers/constants' const missed = checkMissedConfig() if (missed.length !== 0) { @@ -90,7 +92,8 @@ if (isTestInstance()) { // These routes have already cors if ( req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && - req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 + req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 && + req.path.startsWith('/api/') === false ) { return (cors({ origin: '*', @@ -179,7 +182,8 @@ async function startApplication () { await JobQueue.Instance.init() // Caches initializations - VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.SIZE) + VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.SIZE, CACHE.PREVIEWS.MAX_AGE) + VideosCaptionCache.Instance.init(CONFIG.CACHE.VIDEO_CAPTIONS.SIZE, CACHE.VIDEO_CAPTIONS.MAX_AGE) // Enable Schedulers BadActorFollowScheduler.Instance.enable()