1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Generate a name for thumbnails

Allows aggressive caching
This commit is contained in:
Chocobozzz 2021-02-12 16:23:19 +01:00 committed by Chocobozzz
parent 0472d474fd
commit a8b1b40485
11 changed files with 116 additions and 55 deletions

View file

@ -18,7 +18,7 @@ lazyStaticRouter.use(
)
lazyStaticRouter.use(
LAZY_STATIC_PATHS.PREVIEWS + ':uuid.jpg',
LAZY_STATIC_PATHS.PREVIEWS + ':filename',
asyncMiddleware(getPreview)
)
@ -71,7 +71,7 @@ async function getAvatar (req: express.Request, res: express.Response) {
}
async function getPreview (req: express.Request, res: express.Response) {
const result = await VideosPreviewCache.Instance.getFilePath(req.params.uuid)
const result = await VideosPreviewCache.Instance.getFilePath(req.params.filename)
if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER })