mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
api/config: clean up (better formatting)
This commit is contained in:
parent
332eae16b2
commit
0a411196e9
1 changed files with 38 additions and 29 deletions
|
@ -2,41 +2,50 @@ import { loadJSON } from "./misc/load-from-fs.js";
|
||||||
|
|
||||||
const packageJson = loadJSON("./package.json");
|
const packageJson = loadJSON("./package.json");
|
||||||
|
|
||||||
export const
|
const version = packageJson.version;
|
||||||
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",
|
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";
|
||||||
supportedAudio = ["mp3", "ogg", "wav", "opus"],
|
const supportedAudio = ["mp3", "ogg", "wav", "opus"];
|
||||||
ffmpegArgs = {
|
const ffmpegArgs = {
|
||||||
webm: ["-c:v", "copy", "-c:a", "copy"],
|
webm: ["-c:v", "copy", "-c:a", "copy"],
|
||||||
mp4: ["-c:v", "copy", "-c:a", "copy", "-movflags", "faststart+frag_keyframe+empty_moov"],
|
mp4: ["-c:v", "copy", "-c:a", "copy", "-movflags", "faststart+frag_keyframe+empty_moov"],
|
||||||
copy: ["-c:a", "copy"],
|
copy: ["-c:a", "copy"],
|
||||||
audio: ["-ar", "48000", "-ac", "2", "-b:a", "320k"],
|
audio: ["-ar", "48000", "-ac", "2", "-b:a", "320k"],
|
||||||
m4a: ["-movflags", "frag_keyframe+empty_moov"],
|
m4a: ["-movflags", "frag_keyframe+empty_moov"],
|
||||||
gif: ["-vf", "scale=-1:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse", "-loop", "0"]
|
gif: ["-vf", "scale=-1:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse", "-loop", "0"]
|
||||||
},
|
}
|
||||||
|
|
||||||
env = {
|
const env = {
|
||||||
apiURL: process.env.API_URL || '',
|
apiURL: process.env.API_URL || '',
|
||||||
apiPort: process.env.API_PORT || 9000,
|
apiPort: process.env.API_PORT || 9000,
|
||||||
|
|
||||||
listenAddress: process.env.API_LISTEN_ADDRESS,
|
listenAddress: process.env.API_LISTEN_ADDRESS,
|
||||||
freebindCIDR: process.platform === 'linux' && process.env.FREEBIND_CIDR,
|
freebindCIDR: process.platform === 'linux' && process.env.FREEBIND_CIDR,
|
||||||
|
|
||||||
corsWildcard: process.env.CORS_WILDCARD !== '0',
|
corsWildcard: process.env.CORS_WILDCARD !== '0',
|
||||||
corsURL: process.env.CORS_URL,
|
corsURL: process.env.CORS_URL,
|
||||||
|
|
||||||
cookiePath: process.env.COOKIE_PATH,
|
cookiePath: process.env.COOKIE_PATH,
|
||||||
|
|
||||||
rateLimitWindow: (process.env.RATELIMIT_WINDOW && parseInt(process.env.RATELIMIT_WINDOW)) || 60,
|
rateLimitWindow: (process.env.RATELIMIT_WINDOW && parseInt(process.env.RATELIMIT_WINDOW)) || 60,
|
||||||
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,
|
streamLifespan: 90,
|
||||||
|
|
||||||
processingPriority: process.platform !== 'win32'
|
processingPriority: process.platform !== 'win32'
|
||||||
&& process.env.PROCESSING_PRIORITY
|
&& process.env.PROCESSING_PRIORITY
|
||||||
&& parseInt(process.env.PROCESSING_PRIORITY),
|
&& parseInt(process.env.PROCESSING_PRIORITY),
|
||||||
|
|
||||||
externalProxy: process.env.API_EXTERNAL_PROXY,
|
externalProxy: process.env.API_EXTERNAL_PROXY,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
env,
|
||||||
|
|
||||||
|
genericUserAgent,
|
||||||
|
supportedAudio,
|
||||||
|
ffmpegArgs,
|
||||||
|
|
||||||
|
version,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue