stream/manage: pass service name to internal stream

This commit is contained in:
dumbmoron 2024-04-27 10:48:22 +00:00
parent 5f1dc89c42
commit ec746f57a7
No known key found for this signature in database

View file

@ -79,6 +79,7 @@ export function createInternalStream(obj = {}) {
const streamID = nanoid(); const streamID = nanoid();
internalStreamCache[streamID] = { internalStreamCache[streamID] = {
url: obj.url, url: obj.url,
service: obj.service,
controller: new AbortController() controller: new AbortController()
}; };
@ -117,10 +118,16 @@ export function verifyStream(id, hmac, exp, secret, iv) {
} }
if (typeof streamInfo.originalUrls === 'string') { if (typeof streamInfo.originalUrls === 'string') {
streamInfo.urls = createInternalStream({ url: streamInfo.originalUrls }); streamInfo.urls = createInternalStream({
url: streamInfo.originalUrls,
...streamInfo
});
} else if (Array.isArray(streamInfo.originalUrls)) { } else if (Array.isArray(streamInfo.originalUrls)) {
for (const idx in streamInfo.originalUrls) { for (const idx in streamInfo.originalUrls) {
streamInfo.originalUrls[idx] = createInternalStream({ url: streamInfo.originalUrls[idx] }); streamInfo.originalUrls[idx] = createInternalStream({
url: streamInfo.originalUrls[idx],
...streamInfo
});
} }
} else throw 'invalid urls'; } else throw 'invalid urls';