mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-16 13:19:58 +00:00
28 lines
1,004 B
JavaScript
28 lines
1,004 B
JavaScript
import { apiJSON } from "../sub/utils.js";
|
|
import { verifyStream } from "./manage.js";
|
|
import { streamAudioOnly, streamDefault, streamLiveRender } from "./types.js";
|
|
|
|
export default function(res, ip, id, hmac, exp) {
|
|
try {
|
|
let streamInfo = verifyStream(ip, id, hmac, exp);
|
|
if (!streamInfo.error) {
|
|
if (streamInfo.isAudioOnly && streamInfo.type !== "bridge") {
|
|
streamAudioOnly(streamInfo, res);
|
|
} else {
|
|
switch (streamInfo.type) {
|
|
case "render":
|
|
streamLiveRender(streamInfo, res);
|
|
break;
|
|
default:
|
|
streamDefault(streamInfo, res);
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
res.status(streamInfo.status).json(apiJSON(0, { t: streamInfo.error }).body);
|
|
}
|
|
} catch (e) {
|
|
res.status(500).json({ status: "error", text: "Internal Server Error" });
|
|
}
|
|
}
|