Skip to content

Commit

Permalink
quick fix for new routing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfrederiksen committed Oct 16, 2024
1 parent 5767380 commit 7c74b7e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions engine/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,21 +337,22 @@ export class ChannelEngine {
const handleMasterRoute = async (req, res, next) => {
debug(req.params, req.query);
let m;
if (req.params.file.match(/master.m3u8/)) {
const [fileName, sessionId] = req.params.file.split(';session=');
if (fileName.match(/master.m3u8/)) {
await this._handleMasterManifest(req, res, next);
} else if (m = req.params.file.match(/master(\d+).m3u8(;session=(.*))?$/)) {
} else if (m = fileName.match(/master(\d+).m3u8/)) {
req.params[0] = m[1];
req.params[1] = m[2] || req.query['channel'];
req.params[1] = sessionId;
await this._handleMediaManifest(req, res, next);
} else if (m = req.params.file.match(/master-(\S+)_(\S+).m3u8(;session=(.*))?$/)) {
} else if (m = req.params.file.match(/master-(\S+)_(\S+).m3u8/)) {
req.params[0] = m[1];
req.params[1] = m[2];
req.params[2] = m[3] || req.query['channel'];
req.params[2] = sessionId;
await this._handleAudioManifest(req, res, next);
} else if (m = req.params.file.match(/subtitles-(\S+)_(\S+).m3u8(;session=(.*))?$/)) {
} else if (m = req.params.file.match(/subtitles-(\S+)_(\S+).m3u8/)) {
req.params[0] = m[1];
req.params[1] = m[2];
req.params[2] = m[3] || req.query['channel'];
req.params[2] = sessionId;
await this._handleSubtitleManifest(req, res, next);
}
};
Expand All @@ -363,6 +364,7 @@ export class ChannelEngine {
await handleMasterRoute(req, res, next);
});
this.server.pre(preflight.handler);

this.server.get('/eventstream/:sessionId', this._handleEventStream.bind(this));
this.server.get('/status/:sessionId', this._handleStatus.bind(this));
this.server.get('/health', this._handleAggregatedSessionHealth.bind(this));
Expand Down

0 comments on commit 7c74b7e

Please sign in to comment.