diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 71a0f97e2..e1c775180 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -66,6 +66,7 @@ import { liveRouter } from './live' | |||
66 | import { ownershipVideoRouter } from './ownership' | 66 | import { ownershipVideoRouter } from './ownership' |
67 | import { rateVideoRouter } from './rate' | 67 | import { rateVideoRouter } from './rate' |
68 | import { watchingRouter } from './watching' | 68 | import { watchingRouter } from './watching' |
69 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
69 | 70 | ||
70 | const auditLogger = auditLoggerFactory('videos') | 71 | const auditLogger = auditLoggerFactory('videos') |
71 | const videosRouter = express.Router() | 72 | const videosRouter = express.Router() |
@@ -178,7 +179,7 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
178 | // Set timeout to 10 minutes, as Express's default is 2 minutes | 179 | // Set timeout to 10 minutes, as Express's default is 2 minutes |
179 | req.setTimeout(1000 * 60 * 10, () => { | 180 | req.setTimeout(1000 * 60 * 10, () => { |
180 | logger.error('Upload video has timed out.') | 181 | logger.error('Upload video has timed out.') |
181 | return res.sendStatus(408) | 182 | return res.sendStatus(HttpStatusCode.REQUEST_TIMEOUT_408) |
182 | }) | 183 | }) |
183 | 184 | ||
184 | const videoPhysicalFile = req.files['videofile'][0] | 185 | const videoPhysicalFile = req.files['videofile'][0] |
@@ -394,7 +395,9 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
394 | throw err | 395 | throw err |
395 | } | 396 | } |
396 | 397 | ||
397 | return res.type('json').status(204).end() | 398 | return res.type('json') |
399 | .status(HttpStatusCode.NO_CONTENT_204) | ||
400 | .end() | ||
398 | } | 401 | } |
399 | 402 | ||
400 | async function getVideo (req: express.Request, res: express.Response) { | 403 | async function getVideo (req: express.Request, res: express.Response) { |
@@ -421,7 +424,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
421 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, immutableVideoAttrs.uuid) | 424 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, immutableVideoAttrs.uuid) |
422 | if (exists) { | 425 | if (exists) { |
423 | logger.debug('View for ip %s and video %s already exists.', ip, immutableVideoAttrs.uuid) | 426 | logger.debug('View for ip %s and video %s already exists.', ip, immutableVideoAttrs.uuid) |
424 | return res.sendStatus(204) | 427 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
425 | } | 428 | } |
426 | 429 | ||
427 | const video = await VideoModel.load(immutableVideoAttrs.id) | 430 | const video = await VideoModel.load(immutableVideoAttrs.id) |
@@ -454,7 +457,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
454 | 457 | ||
455 | Hooks.runAction('action:api.video.viewed', { video, ip }) | 458 | Hooks.runAction('action:api.video.viewed', { video, ip }) |
456 | 459 | ||
457 | return res.sendStatus(204) | 460 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
458 | } | 461 | } |
459 | 462 | ||
460 | async function getVideoDescription (req: express.Request, res: express.Response) { | 463 | async function getVideoDescription (req: express.Request, res: express.Response) { |
@@ -517,5 +520,7 @@ async function removeVideo (req: express.Request, res: express.Response) { | |||
517 | 520 | ||
518 | Hooks.runAction('action:api.video.deleted', { video: videoInstance }) | 521 | Hooks.runAction('action:api.video.deleted', { video: videoInstance }) |
519 | 522 | ||
520 | return res.type('json').status(204).end() | 523 | return res.type('json') |
524 | .status(HttpStatusCode.NO_CONTENT_204) | ||
525 | .end() | ||
521 | } | 526 | } |