2024-08-03 09:47:13 +01:00
|
|
|
import { loadJSON } from "./misc/load-from-fs.js";
|
2024-05-12 15:06:04 +01:00
|
|
|
|
2023-10-12 12:33:26 +01:00
|
|
|
const packageJson = loadJSON("./package.json");
|
2023-12-09 11:00:54 +00:00
|
|
|
|
2024-08-02 16:32:00 +01:00
|
|
|
export const
|
2024-08-03 09:47:13 +01:00
|
|
|
version = packageJson.version,
|
|
|
|
|
|
|
|
genericUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
|
|
|
supportedAudio = ["mp3", "ogg", "wav", "opus"],
|
|
|
|
ffmpegArgs = {
|
|
|
|
webm: ["-c:v", "copy", "-c:a", "copy"],
|
|
|
|
mp4: ["-c:v", "copy", "-c:a", "copy", "-movflags", "faststart+frag_keyframe+empty_moov"],
|
|
|
|
copy: ["-c:a", "copy"],
|
|
|
|
audio: ["-ar", "48000", "-ac", "2", "-b:a", "320k"],
|
|
|
|
m4a: ["-movflags", "frag_keyframe+empty_moov"],
|
|
|
|
gif: ["-vf", "scale=-1:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse", "-loop", "0"]
|
|
|
|
},
|
|
|
|
|
2024-08-02 16:32:00 +01:00
|
|
|
env = {
|
|
|
|
apiURL: process.env.API_URL || '',
|
2024-04-29 12:56:05 +01:00
|
|
|
apiPort: process.env.API_PORT || 9000,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-05-13 19:20:10 +01:00
|
|
|
listenAddress: process.env.API_LISTEN_ADDRESS,
|
2024-05-16 08:54:11 +01:00
|
|
|
freebindCIDR: process.platform === 'linux' && process.env.FREEBIND_CIDR,
|
|
|
|
|
2024-04-29 12:56:05 +01:00
|
|
|
corsWildcard: process.env.CORS_WILDCARD !== '0',
|
|
|
|
corsURL: process.env.CORS_URL,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-04-29 12:56:05 +01:00
|
|
|
cookiePath: process.env.COOKIE_PATH,
|
2024-05-16 08:54:11 +01:00
|
|
|
|
2024-08-03 09:47:13 +01:00
|
|
|
rateLimitWindow: (process.env.RATELIMIT_WINDOW && parseInt(process.env.RATELIMIT_WINDOW)) || 60,
|
2024-05-16 08:54:11 +01:00
|
|
|
rateLimitMax: (process.env.RATELIMIT_MAX && parseInt(process.env.RATELIMIT_MAX)) || 20,
|
|
|
|
|
2024-05-16 15:57:48 +01:00
|
|
|
durationLimit: (process.env.DURATION_LIMIT && parseInt(process.env.DURATION_LIMIT)) || 10800,
|
2024-05-16 16:00:11 +01:00
|
|
|
streamLifespan: 90,
|
2024-05-16 15:57:48 +01:00
|
|
|
|
2024-05-14 10:37:41 +01:00
|
|
|
processingPriority: process.platform !== 'win32'
|
2024-08-03 09:47:13 +01:00
|
|
|
&& process.env.PROCESSING_PRIORITY
|
|
|
|
&& parseInt(process.env.PROCESSING_PRIORITY),
|
2024-07-24 16:49:47 +01:00
|
|
|
|
|
|
|
externalProxy: process.env.API_EXTERNAL_PROXY,
|
2024-04-29 12:56:05 +01:00
|
|
|
}
|