diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-12 16:23:19 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-02-16 10:36:44 +0100 |
commit | a8b1b40485145ac1eae513a661d7dd6e0986ce96 (patch) | |
tree | 79436a042f1ed350278dd69e365f37ee623aa539 /server/controllers/lazy-static.ts | |
parent | 0472d474fdadd05211fb4f90ce275801db515d08 (diff) | |
download | PeerTube-a8b1b40485145ac1eae513a661d7dd6e0986ce96.tar.gz PeerTube-a8b1b40485145ac1eae513a661d7dd6e0986ce96.tar.zst PeerTube-a8b1b40485145ac1eae513a661d7dd6e0986ce96.zip |
Generate a name for thumbnails
Allows aggressive caching
Diffstat (limited to 'server/controllers/lazy-static.ts')
-rw-r--r-- | server/controllers/lazy-static.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/controllers/lazy-static.ts b/server/controllers/lazy-static.ts index 5c6369c9e..847d24fd4 100644 --- a/server/controllers/lazy-static.ts +++ b/server/controllers/lazy-static.ts | |||
@@ -18,7 +18,7 @@ lazyStaticRouter.use( | |||
18 | ) | 18 | ) |
19 | 19 | ||
20 | lazyStaticRouter.use( | 20 | lazyStaticRouter.use( |
21 | LAZY_STATIC_PATHS.PREVIEWS + ':uuid.jpg', | 21 | LAZY_STATIC_PATHS.PREVIEWS + ':filename', |
22 | asyncMiddleware(getPreview) | 22 | asyncMiddleware(getPreview) |
23 | ) | 23 | ) |
24 | 24 | ||
@@ -71,7 +71,7 @@ async function getAvatar (req: express.Request, res: express.Response) { | |||
71 | } | 71 | } |
72 | 72 | ||
73 | async function getPreview (req: express.Request, res: express.Response) { | 73 | async function getPreview (req: express.Request, res: express.Response) { |
74 | const result = await VideosPreviewCache.Instance.getFilePath(req.params.uuid) | 74 | const result = await VideosPreviewCache.Instance.getFilePath(req.params.filename) |
75 | if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404) | 75 | if (!result) return res.sendStatus(HttpStatusCode.NOT_FOUND_404) |
76 | 76 | ||
77 | return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER }) | 77 | return res.sendFile(result.path, { maxAge: STATIC_MAX_AGE.SERVER }) |