aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/lazy-static.ts4
-rw-r--r--server/controllers/static.ts29
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
20lazyStaticRouter.use( 20lazyStaticRouter.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
73async function getPreview (req: express.Request, res: express.Response) { 73async 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 @@
1import * as cors from 'cors' 1import * as cors from 'cors'
2import * as express from 'express' 2import * as express from 'express'
3import { join } from 'path'
4import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
5import { serveIndexHTML } from '@server/lib/client-html'
6import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
7import { MVideoFile, MVideoFullLight } from '@server/types/models'
8import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
9import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
10import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
11import { root } from '../helpers/core-utils'
12import { CONFIG, isEmailEnabled } from '../initializers/config'
3import { 13import {
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'
14import { cacheRoute } from '../middlewares/cache' 24import { getThemeOrDefault } from '../lib/plugins/theme-utils'
25import { getEnabledResolutions } from '../lib/video-transcoding'
15import { asyncMiddleware, videosDownloadValidator } from '../middlewares' 26import { asyncMiddleware, videosDownloadValidator } from '../middlewares'
16import { VideoModel } from '../models/video/video' 27import { cacheRoute } from '../middlewares/cache'
17import { UserModel } from '../models/account/user' 28import { UserModel } from '../models/account/user'
29import { VideoModel } from '../models/video/video'
18import { VideoCommentModel } from '../models/video/video-comment' 30import { VideoCommentModel } from '../models/video/video-comment'
19import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
20import { join } from 'path'
21import { root } from '../helpers/core-utils'
22import { getEnabledResolutions } from '../lib/video-transcoding'
23import { CONFIG, isEmailEnabled } from '../initializers/config'
24import { getPreview, getVideoCaption } from './lazy-static'
25import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
26import { MVideoFile, MVideoFullLight } from '@server/types/models'
27import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
28import { getThemeOrDefault } from '../lib/plugins/theme-utils'
29import { getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { serveIndexHTML } from '@server/lib/client-html'
32 31
33const staticRouter = express.Router() 32const staticRouter = express.Router()
34 33