diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/lazy-static.ts | 4 | ||||
-rw-r--r-- | server/controllers/static.ts | 29 |
2 files changed, 16 insertions, 17 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 }) |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index a645c496b..2064857eb 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,5 +1,15 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { join } from 'path' | ||
4 | import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config' | ||
5 | import { serveIndexHTML } from '@server/lib/client-html' | ||
6 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' | ||
7 | import { MVideoFile, MVideoFullLight } from '@server/types/models' | ||
8 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
9 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' | ||
10 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | ||
11 | import { root } from '../helpers/core-utils' | ||
12 | import { CONFIG, isEmailEnabled } from '../initializers/config' | ||
3 | import { | 13 | import { |
4 | CONSTRAINTS_FIELDS, | 14 | CONSTRAINTS_FIELDS, |
5 | DEFAULT_THEME_NAME, | 15 | DEFAULT_THEME_NAME, |
@@ -11,24 +21,13 @@ import { | |||
11 | STATIC_PATHS, | 21 | STATIC_PATHS, |
12 | WEBSERVER | 22 | WEBSERVER |
13 | } from '../initializers/constants' | 23 | } from '../initializers/constants' |
14 | import { cacheRoute } from '../middlewares/cache' | 24 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' |
25 | import { getEnabledResolutions } from '../lib/video-transcoding' | ||
15 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' | 26 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' |
16 | import { VideoModel } from '../models/video/video' | 27 | import { cacheRoute } from '../middlewares/cache' |
17 | import { UserModel } from '../models/account/user' | 28 | import { UserModel } from '../models/account/user' |
29 | import { VideoModel } from '../models/video/video' | ||
18 | import { VideoCommentModel } from '../models/video/video-comment' | 30 | import { VideoCommentModel } from '../models/video/video-comment' |
19 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | ||
20 | import { join } from 'path' | ||
21 | import { root } from '../helpers/core-utils' | ||
22 | import { getEnabledResolutions } from '../lib/video-transcoding' | ||
23 | import { CONFIG, isEmailEnabled } from '../initializers/config' | ||
24 | import { getPreview, getVideoCaption } from './lazy-static' | ||
25 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' | ||
26 | import { MVideoFile, MVideoFullLight } from '@server/types/models' | ||
27 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' | ||
28 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' | ||
29 | import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config' | ||
30 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
31 | import { serveIndexHTML } from '@server/lib/client-html' | ||
32 | 31 | ||
33 | const staticRouter = express.Router() | 32 | const staticRouter = express.Router() |
34 | 33 | ||