X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fstatic.ts;h=d57dba6ce24eae3f0ee07b56d7d80b95eb0c65e8;hb=a41b9da1a9ce49df82ea10c82de4c2fbc6d1b189;hp=f6bb88725956e5ec4b255978c367c1ef0de5bc76;hpb=74dc3bca2b14f5fd3fe80c394dfc34177a46db77;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/static.ts b/server/controllers/static.ts index f6bb88725..d57dba6ce 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -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()