]>
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' | |
5 | ||
6 | const liveRouter = express.Router() | |
7 | ||
8 | liveRouter.use('/segments-sha256/:videoUUID', | |
4a7f9024 | 9 | cors(), |
c6c0fa6c C |
10 | getSegmentsSha256 |
11 | ) | |
12 | ||
13 | // --------------------------------------------------------------------------- | |
14 | ||
15 | export { | |
16 | liveRouter | |
17 | } | |
18 | ||
19 | // --------------------------------------------------------------------------- | |
20 | ||
21 | function getSegmentsSha256 (req: express.Request, res: express.Response) { | |
22 | const videoUUID = req.params.videoUUID | |
23 | ||
24 | const result = LiveManager.Instance.getSegmentsSha256(videoUUID) | |
25 | ||
26 | if (!result) { | |
27 | return res.sendStatus(404) | |
28 | } | |
29 | ||
30 | return res.json(mapToJSON(result)) | |
31 | } |