]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/controllers/live.ts
Remove annoying superfluous slash
[github/Chocobozzz/PeerTube.git] / server / controllers / live.ts
... / ...
CommitLineData
1import * as cors from 'cors'
2import * as express from 'express'
3import { mapToJSON } from '@server/helpers/core-utils'
4import { LiveManager } from '@server/lib/live-manager'
5import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
6
7const liveRouter = express.Router()
8
9liveRouter.use('/segments-sha256/:videoUUID',
10 cors(),
11 getSegmentsSha256
12)
13
14// ---------------------------------------------------------------------------
15
16export {
17 liveRouter
18}
19
20// ---------------------------------------------------------------------------
21
22function getSegmentsSha256 (req: express.Request, res: express.Response) {
23 const videoUUID = req.params.videoUUID
24
25 const result = LiveManager.Instance.getSegmentsSha256(videoUUID)
26
27 if (!result) {
28 return res.sendStatus(HttpStatusCode.NOT_FOUND_404)
29 }
30
31 return res.json(mapToJSON(result))
32}