]>
Commit | Line | Data |
---|---|---|
4a7f9024 | 1 | import * as cors from 'cors' |
c6c0fa6c C |
2 | import * as express from 'express' |
3 | import { mapToJSON } from '@server/helpers/core-utils' | |
4 | import { LiveManager } from '@server/lib/live-manager' | |
2d53be02 | 5 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' |
c6c0fa6c C |
6 | |
7 | const liveRouter = express.Router() | |
8 | ||
9 | liveRouter.use('/segments-sha256/:videoUUID', | |
4a7f9024 | 10 | cors(), |
c6c0fa6c C |
11 | getSegmentsSha256 |
12 | ) | |
13 | ||
14 | // --------------------------------------------------------------------------- | |
15 | ||
16 | export { | |
17 | liveRouter | |
18 | } | |
19 | ||
20 | // --------------------------------------------------------------------------- | |
21 | ||
22 | function 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) { | |
76148b27 | 28 | return res.status(HttpStatusCode.NOT_FOUND_404).end() |
c6c0fa6c C |
29 | } |
30 | ||
31 | return res.json(mapToJSON(result)) | |
32 | } |