api/stream/manage: make itunnel port configurable
this allows us to bind internal streams to a specific worker in the future
This commit is contained in:
parent
132255b004
commit
93e6344fc7
2 changed files with 5 additions and 2 deletions
|
@ -55,6 +55,9 @@ const env = {
|
||||||
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
const genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
|
||||||
const cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
|
const cobaltUserAgent = `cobalt/${version} (+https://github.com/imputnet/cobalt)`;
|
||||||
|
|
||||||
|
export let tunnelPort = env.apiPort;
|
||||||
|
export const setTunnelPort = (port) => tunnelPort = port;
|
||||||
|
|
||||||
if (env.sessionEnabled && env.jwtSecret.length < 16) {
|
if (env.sessionEnabled && env.jwtSecret.length < 16) {
|
||||||
throw new Error("JWT_SECRET env is too short (must be at least 16 characters long)");
|
throw new Error("JWT_SECRET env is too short (must be at least 16 characters long)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { randomBytes } from "crypto";
|
||||||
import { strict as assert } from "assert";
|
import { strict as assert } from "assert";
|
||||||
import { setMaxListeners } from "node:events";
|
import { setMaxListeners } from "node:events";
|
||||||
|
|
||||||
import { env } from "../config.js";
|
import { env, tunnelPort } from "../config.js";
|
||||||
import { closeRequest } from "./shared.js";
|
import { closeRequest } from "./shared.js";
|
||||||
import { decryptStream, encryptStream, generateHmac } from "../misc/crypto.js";
|
import { decryptStream, encryptStream, generateHmac } from "../misc/crypto.js";
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export function createInternalStream(url, obj = {}) {
|
||||||
isHLS: obj.isHLS,
|
isHLS: obj.isHLS,
|
||||||
});
|
});
|
||||||
|
|
||||||
let streamLink = new URL('/itunnel', `http://127.0.0.1:${env.apiPort}`);
|
let streamLink = new URL('/itunnel', `http://127.0.0.1:${tunnelPort}`);
|
||||||
streamLink.searchParams.set('id', streamID);
|
streamLink.searchParams.set('id', streamID);
|
||||||
|
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
|
|
Loading…
Reference in a new issue