mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
stream/manage: fix stream lifespan
so that stream lifespan isn't 90 ms
This commit is contained in:
parent
ee1e899b39
commit
7b67f05bbf
1 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,7 @@ const freebind = env.freebindCIDR && await import('freebind').catch(() => {});
|
||||||
const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube'];
|
const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube'];
|
||||||
|
|
||||||
const streamCache = new NodeCache({
|
const streamCache = new NodeCache({
|
||||||
stdTTL: env.streamLifespan/1000,
|
stdTTL: env.streamLifespan,
|
||||||
checkperiod: 10,
|
checkperiod: 10,
|
||||||
deleteOnExpire: true
|
deleteOnExpire: true
|
||||||
})
|
})
|
||||||
|
@ -28,7 +28,7 @@ export function createStream(obj) {
|
||||||
const streamID = nanoid(),
|
const streamID = nanoid(),
|
||||||
iv = randomBytes(16).toString('base64url'),
|
iv = randomBytes(16).toString('base64url'),
|
||||||
secret = randomBytes(32).toString('base64url'),
|
secret = randomBytes(32).toString('base64url'),
|
||||||
exp = new Date().getTime() + env.streamLifespan,
|
exp = new Date().getTime() + env.streamLifespan * 1000,
|
||||||
hmac = generateHmac(`${streamID},${exp},${iv},${secret}`, hmacSalt),
|
hmac = generateHmac(`${streamID},${exp},${iv},${secret}`, hmacSalt),
|
||||||
streamData = {
|
streamData = {
|
||||||
exp: exp,
|
exp: exp,
|
||||||
|
|
Loading…
Reference in a new issue