aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/client.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r--server/controllers/client.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index 1b140b14a..9a72fe8e0 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -2,8 +2,6 @@ import * as express from 'express'
2import { join } from 'path' 2import { join } from 'path'
3import * as validator from 'validator' 3import * as validator from 'validator'
4import * as Bluebird from 'bluebird' 4import * as Bluebird from 'bluebird'
5
6import { database as db } from '../initializers/database'
7import { 5import {
8 CONFIG, 6 CONFIG,
9 STATIC_PATHS, 7 STATIC_PATHS,
@@ -13,7 +11,7 @@ import {
13} from '../initializers' 11} from '../initializers'
14import { root, readFileBufferPromise, escapeHTML } from '../helpers' 12import { root, readFileBufferPromise, escapeHTML } from '../helpers'
15import { asyncMiddleware } from '../middlewares' 13import { asyncMiddleware } from '../middlewares'
16import { VideoInstance } from '../models' 14import { VideoModel } from '../models/video/video'
17 15
18const clientsRouter = express.Router() 16const clientsRouter = express.Router()
19 17
@@ -49,7 +47,7 @@ export {
49 47
50// --------------------------------------------------------------------------- 48// ---------------------------------------------------------------------------
51 49
52function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance) { 50function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {
53 const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName() 51 const previewUrl = CONFIG.WEBSERVER.URL + STATIC_PATHS.PREVIEWS + video.getPreviewName()
54 const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid 52 const videoUrl = CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
55 53
@@ -108,13 +106,13 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
108 106
109async function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) { 107async function generateWatchHtmlPage (req: express.Request, res: express.Response, next: express.NextFunction) {
110 const videoId = '' + req.params.id 108 const videoId = '' + req.params.id
111 let videoPromise: Bluebird<VideoInstance> 109 let videoPromise: Bluebird<VideoModel>
112 110
113 // Let Angular application handle errors 111 // Let Angular application handle errors
114 if (validator.isUUID(videoId, 4)) { 112 if (validator.isUUID(videoId, 4)) {
115 videoPromise = db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) 113 videoPromise = VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(videoId)
116 } else if (validator.isInt(videoId)) { 114 } else if (validator.isInt(videoId)) {
117 videoPromise = db.Video.loadAndPopulateAccountAndServerAndTags(+videoId) 115 videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(+videoId)
118 } else { 116 } else {
119 return res.sendFile(indexPath) 117 return res.sendFile(indexPath)
120 } 118 }