diff options
Diffstat (limited to 'server/controllers/live.ts')
-rw-r--r-- | server/controllers/live.ts | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/server/controllers/live.ts b/server/controllers/live.ts new file mode 100644 index 000000000..fa4c2cc1a --- /dev/null +++ b/server/controllers/live.ts | |||
@@ -0,0 +1,29 @@ | |||
1 | import * as express from 'express' | ||
2 | import { mapToJSON } from '@server/helpers/core-utils' | ||
3 | import { LiveManager } from '@server/lib/live-manager' | ||
4 | |||
5 | const liveRouter = express.Router() | ||
6 | |||
7 | liveRouter.use('/segments-sha256/:videoUUID', | ||
8 | getSegmentsSha256 | ||
9 | ) | ||
10 | |||
11 | // --------------------------------------------------------------------------- | ||
12 | |||
13 | export { | ||
14 | liveRouter | ||
15 | } | ||
16 | |||
17 | // --------------------------------------------------------------------------- | ||
18 | |||
19 | function getSegmentsSha256 (req: express.Request, res: express.Response) { | ||
20 | const videoUUID = req.params.videoUUID | ||
21 | |||
22 | const result = LiveManager.Instance.getSegmentsSha256(videoUUID) | ||
23 | |||
24 | if (!result) { | ||
25 | return res.sendStatus(404) | ||
26 | } | ||
27 | |||
28 | return res.json(mapToJSON(result)) | ||
29 | } | ||