X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Flive.ts;h=81008f120d213cdb5b9975b9c3958d0e4e2a2ea4;hb=0bc53e20296de68288481e2375b297626087174b;hp=fa4c2cc1a300c5e9b3045a145b8863fac071d972;hpb=c6c0fa6cd8fe8f752463d8982c3dbcd448739c4e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/live.ts b/server/controllers/live.ts index fa4c2cc1a..81008f120 100644 --- a/server/controllers/live.ts +++ b/server/controllers/live.ts @@ -1,10 +1,13 @@ -import * as express from 'express' +import cors from 'cors' +import express from 'express' import { mapToJSON } from '@server/helpers/core-utils' -import { LiveManager } from '@server/lib/live-manager' +import { LiveSegmentShaStore } from '@server/lib/live' +import { HttpStatusCode } from '@shared/models' const liveRouter = express.Router() liveRouter.use('/segments-sha256/:videoUUID', + cors(), getSegmentsSha256 ) @@ -19,10 +22,10 @@ export { function getSegmentsSha256 (req: express.Request, res: express.Response) { const videoUUID = req.params.videoUUID - const result = LiveManager.Instance.getSegmentsSha256(videoUUID) + const result = LiveSegmentShaStore.Instance.getSegmentsSha256(videoUUID) if (!result) { - return res.sendStatus(404) + return res.status(HttpStatusCode.NOT_FOUND_404).end() } return res.json(mapToJSON(result))