From 6302d599cdf98b5a5363a2a1dcdc266447950191 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Feb 2021 14:08:16 +0100 Subject: Generate a name for caption files --- server/controllers/lazy-static.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'server/controllers/lazy-static.ts') diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts index 847d24fd4..656dea223 100644 --- a/server/controllers/lazy-static.ts +++ b/server/controllers/lazy-static.ts @@ -23,7 +23,7 @@ lazyStaticRouter.use( ) lazyStaticRouter.use( - LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':videoId-:captionLanguage([a-z]+).vtt', + LAZY_STATIC_PATHS.VIDEO_CAPTIONS + ':filename', asyncMiddleware(getVideoCaption) ) @@ -78,10 +78,7 @@ async function getPreview (req: express.Request, res: express.Response) { } async function getVideoCaption (req: express.Request, res: express.Response) { - const result = await VideosCaptionCache.Instance.getFilePath({ - videoId: req.params.videoId, - language: req.params.captionLanguage - }) + const result = await VideosCaptionCache.Instance.getFilePath(req.params.filename) if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404) return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER }) -- cgit v1.2.3