api: disable youtube HLS by default & add env to enable it

This commit is contained in:
wukko
2025-06-17 13:21:16 +06:00
parent 1e7406de9d
commit af99e7218c
3 changed files with 22 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import * as cluster from "../misc/cluster.js";
import { Green, Yellow } from "../misc/console-text.js";
const forceLocalProcessingOptions = ["never", "session", "always"];
const youtubeHlsOptions = ["never", "key", "always"];
export const loadEnvs = (env = process.env) => {
const disabledServices = env.DISABLED_SERVICES?.split(',') || [];
@@ -74,6 +75,9 @@ export const loadEnvs = (env = process.env) => {
// "never" | "session" | "always"
forceLocalProcessing: env.FORCE_LOCAL_PROCESSING ?? "never",
// "never" | "key" | "always"
enableDeprecatedYoutubeHls: env.ENABLE_DEPRECATED_YOUTUBE_HLS ?? "never",
envFile: env.API_ENV_FILE,
envRemoteReloadInterval: 300,
};
@@ -106,6 +110,12 @@ export const validateEnvs = async (env) => {
throw new Error("Invalid FORCE_LOCAL_PROCESSING");
}
if (env.enableDeprecatedYoutubeHls && !youtubeHlsOptions.includes(env.enableDeprecatedYoutubeHls)) {
console.error("ENABLE_DEPRECATED_YOUTUBE_HLS is invalid.");
console.error(`Supported options are are: ${youtubeHlsOptions.join(', ')}\n`);
throw new Error("Invalid ENABLE_DEPRECATED_YOUTUBE_HLS");
}
if (env.externalProxy && env.freebindCIDR) {
throw new Error('freebind is not available when external proxy is enabled')
}