diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 15ef8d458..6a73e13d0 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -57,6 +57,7 @@ import { videoCaptionsRouter } from './captions' | |||
57 | import { videoImportsRouter } from './import' | 57 | import { videoImportsRouter } from './import' |
58 | import { resetSequelizeInstance } from '../../../helpers/database-utils' | 58 | import { resetSequelizeInstance } from '../../../helpers/database-utils' |
59 | import { rename } from 'fs-extra' | 59 | import { rename } from 'fs-extra' |
60 | import { watchingRouter } from './watching' | ||
60 | 61 | ||
61 | const auditLogger = auditLoggerFactory('videos') | 62 | const auditLogger = auditLoggerFactory('videos') |
62 | const videosRouter = express.Router() | 63 | const videosRouter = express.Router() |
@@ -86,6 +87,7 @@ videosRouter.use('/', videoCommentRouter) | |||
86 | videosRouter.use('/', videoCaptionsRouter) | 87 | videosRouter.use('/', videoCaptionsRouter) |
87 | videosRouter.use('/', videoImportsRouter) | 88 | videosRouter.use('/', videoImportsRouter) |
88 | videosRouter.use('/', ownershipVideoRouter) | 89 | videosRouter.use('/', ownershipVideoRouter) |
90 | videosRouter.use('/', watchingRouter) | ||
89 | 91 | ||
90 | videosRouter.get('/categories', listVideoCategories) | 92 | videosRouter.get('/categories', listVideoCategories) |
91 | videosRouter.get('/licences', listVideoLicences) | 93 | videosRouter.get('/licences', listVideoLicences) |
@@ -119,6 +121,7 @@ videosRouter.get('/:id/description', | |||
119 | asyncMiddleware(getVideoDescription) | 121 | asyncMiddleware(getVideoDescription) |
120 | ) | 122 | ) |
121 | videosRouter.get('/:id', | 123 | videosRouter.get('/:id', |
124 | optionalAuthenticate, | ||
122 | asyncMiddleware(videosGetValidator), | 125 | asyncMiddleware(videosGetValidator), |
123 | getVideo | 126 | getVideo |
124 | ) | 127 | ) |
@@ -433,7 +436,8 @@ async function listVideos (req: express.Request, res: express.Response, next: ex | |||
433 | tagsAllOf: req.query.tagsAllOf, | 436 | tagsAllOf: req.query.tagsAllOf, |
434 | nsfw: buildNSFWFilter(res, req.query.nsfw), | 437 | nsfw: buildNSFWFilter(res, req.query.nsfw), |
435 | filter: req.query.filter as VideoFilter, | 438 | filter: req.query.filter as VideoFilter, |
436 | withFiles: false | 439 | withFiles: false, |
440 | userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined | ||
437 | }) | 441 | }) |
438 | 442 | ||
439 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 443 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |