import { videoImportsRouter } from './import'
import { resetSequelizeInstance } from '../../../helpers/database-utils'
import { rename } from 'fs-extra'
+import { watchingRouter } from './watching'
const auditLogger = auditLoggerFactory('videos')
const videosRouter = express.Router()
videosRouter.use('/', videoCaptionsRouter)
videosRouter.use('/', videoImportsRouter)
videosRouter.use('/', ownershipVideoRouter)
+videosRouter.use('/', watchingRouter)
videosRouter.get('/categories', listVideoCategories)
videosRouter.get('/licences', listVideoLicences)
asyncMiddleware(getVideoDescription)
)
videosRouter.get('/:id',
+ optionalAuthenticate,
asyncMiddleware(videosGetValidator),
getVideo
)
}
async function addVideo (req: express.Request, res: express.Response) {
+ // Processing the video could be long
+ // Set timeout to 10 minutes
+ req.setTimeout(1000 * 60 * 10, () => {
+ logger.error('Upload video has timed out.')
+ return res.sendStatus(408)
+ })
+
const videoPhysicalFile = req.files['videofile'][0]
const videoInfo: VideoCreate = req.body
tagsAllOf: req.query.tagsAllOf,
nsfw: buildNSFWFilter(res, req.query.nsfw),
filter: req.query.filter as VideoFilter,
- withFiles: false
+ withFiles: false,
+ userId: res.locals.oauth ? res.locals.oauth.token.User.id : undefined
})
return res.json(getFormattedObjects(resultList.data, resultList.total))