mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
config: move streamLifespan
This commit is contained in:
parent
d1e8929ee2
commit
9eed3b5b67
3 changed files with 4 additions and 5 deletions
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"streamLifespan": 90000,
|
|
||||||
"genericUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
"genericUserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
||||||
"authorInfo": {
|
"authorInfo": {
|
||||||
"support": {
|
"support": {
|
||||||
|
|
|
@ -45,6 +45,7 @@ const
|
||||||
rateLimitMax: (process.env.RATELIMIT_MAX && parseInt(process.env.RATELIMIT_MAX)) || 20,
|
rateLimitMax: (process.env.RATELIMIT_MAX && parseInt(process.env.RATELIMIT_MAX)) || 20,
|
||||||
|
|
||||||
durationLimit: (process.env.DURATION_LIMIT && parseInt(process.env.DURATION_LIMIT)) || 10800,
|
durationLimit: (process.env.DURATION_LIMIT && parseInt(process.env.DURATION_LIMIT)) || 10800,
|
||||||
|
streamLifespan: 90,
|
||||||
|
|
||||||
processingPriority: process.platform !== 'win32'
|
processingPriority: process.platform !== 'win32'
|
||||||
&& process.env.PROCESSING_PRIORITY
|
&& process.env.PROCESSING_PRIORITY
|
||||||
|
@ -55,7 +56,6 @@ export const
|
||||||
services = servicesConfigJson.config,
|
services = servicesConfigJson.config,
|
||||||
audioIgnore = servicesConfigJson.audioIgnore,
|
audioIgnore = servicesConfigJson.audioIgnore,
|
||||||
version = packageJson.version,
|
version = packageJson.version,
|
||||||
streamLifespan = config.streamLifespan,
|
|
||||||
genericUserAgent = config.genericUserAgent,
|
genericUserAgent = config.genericUserAgent,
|
||||||
repo = packageJson.bugs.url.replace('/issues', ''),
|
repo = packageJson.bugs.url.replace('/issues', ''),
|
||||||
authorInfo = config.authorInfo,
|
authorInfo = config.authorInfo,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { randomBytes } from "crypto";
|
||||||
import { nanoid } from "nanoid";
|
import { nanoid } from "nanoid";
|
||||||
|
|
||||||
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
|
import { decryptStream, encryptStream, generateHmac } from "../sub/crypto.js";
|
||||||
import { streamLifespan, env } from "../config.js";
|
import { env } from "../config.js";
|
||||||
import { strict as assert } from "assert";
|
import { strict as assert } from "assert";
|
||||||
|
|
||||||
// optional dependency
|
// optional dependency
|
||||||
|
@ -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: streamLifespan/1000,
|
stdTTL: env.streamLifespan/1000,
|
||||||
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() + streamLifespan,
|
exp = new Date().getTime() + env.streamLifespan,
|
||||||
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