X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fstatic.ts;h=d57dba6ce24eae3f0ee07b56d7d80b95eb0c65e8;hb=a41b9da1a9ce49df82ea10c82de4c2fbc6d1b189;hp=be5fcc8ede732aff6f66c3e8d7c0e6faec5bd3f8;hpb=6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/static.ts b/server/controllers/static.ts index be5fcc8ed..d57dba6ce 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -7,7 +7,7 @@ import { STATIC_MAX_AGE, STATIC_PATHS, WEBSERVER -} from '../initializers' +} from '../initializers/constants' import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' import { cacheRoute } from '../middlewares/cache' import { asyncMiddleware, videosGetValidator } from '../middlewares' @@ -164,24 +164,24 @@ export { // --------------------------------------------------------------------------- -async function getPreview (req: express.Request, res: express.Response, next: express.NextFunction) { - const path = await VideosPreviewCache.Instance.getFilePath(req.params.uuid) - if (!path) return res.sendStatus(404) +async function getPreview (req: express.Request, res: express.Response) { + const result = await VideosPreviewCache.Instance.getFilePath(req.params.uuid) + if (!result) return res.sendStatus(404) - return res.sendFile(path, { maxAge: STATIC_MAX_AGE }) + return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE }) } async function getVideoCaption (req: express.Request, res: express.Response) { - const path = await VideosCaptionCache.Instance.getFilePath({ + const result = await VideosCaptionCache.Instance.getFilePath({ videoId: req.params.videoId, language: req.params.captionLanguage }) - if (!path) return res.sendStatus(404) + if (!result) return res.sendStatus(404) - return res.sendFile(path, { maxAge: STATIC_MAX_AGE }) + return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE }) } -async function generateNodeinfo (req: express.Request, res: express.Response, next: express.NextFunction) { +async function generateNodeinfo (req: express.Request, res: express.Response) { const { totalVideos } = await VideoModel.getStats() const { totalLocalVideoComments } = await VideoCommentModel.getStats() const { totalUsers } = await UserModel.getStats()