feat: optional YouTube Music source (cookies volume + wizard step)

Adds a step_youtube wizard prompt (enable + cookies host folder), the @YOUTUBE_VOLUME@ token in templates/compose/backend.yml substituted in compose_gen, a YOUTUBE_ENABLED/cookies env block, ensure_youtube_dir in lifecycle, en/ru strings, and a README step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Senko-san
2026-06-14 14:04:49 +03:00
parent 4108121984
commit 3a63ced4d4
8 changed files with 89 additions and 1 deletions
+8
View File
@@ -31,6 +31,13 @@ generate_compose() {
webui_ports=" ports:${nl} - \"\${WEBUI_PORT}:80\""
fi
# YouTube cookies volume: mounted into api+worker only when the source is
# enabled. The host path comes from .env.deploy (YOUTUBE_COOKIES_HOST_PATH).
local youtube_volume=""
if [[ "$CFG_YOUTUBE" == "yes" ]]; then
youtube_volume=" - \${YOUTUBE_COOKIES_HOST_PATH}:/data/youtube"
fi
# Caddy publish ports: 80/443 with a domain (auto-HTTPS), else plain HTTP.
if [[ "$CFG_HTTPS" == "yes" ]]; then
caddy_ports=" - \"80:80\"${nl} - \"443:443\""
@@ -41,6 +48,7 @@ generate_compose() {
# -- assemble ---------------------------------------------------------
local backend webui caddy
backend="$(_frag backend.yml)"
backend="${backend//@YOUTUBE_VOLUME@/$youtube_volume}"
backend="${backend//@API_PORTS@/$api_ports}"
backend="${backend//@API_DEPENDS@/$api_depends}"
backend="${backend//@WORKER_DEPENDS@/$worker_depends}"
+19
View File
@@ -93,5 +93,24 @@ generate_env() {
} >>"$ENV_FILE"
fi
# -- YouTube Music source ---------------------------------------------
# COOKIES_HOST_PATH is consumed by the compose volume; COOKIES_PATH is the
# in-container path the backend reads (only used when the file is present).
if [[ "${CFG_YOUTUBE:-no}" == "yes" ]]; then
{
echo ""
echo "# -- YouTube Music source -----------------------------------------------"
echo "YOUTUBE_ENABLED=true"
echo "YOUTUBE_COOKIES_HOST_PATH=${CFG_YOUTUBE_COOKIES_HOST_PATH}"
echo "YOUTUBE_COOKIES_PATH=/data/youtube/cookies.txt"
} >>"$ENV_FILE"
else
{
echo ""
echo "# -- YouTube Music source (disabled) ------------------------------------"
echo "YOUTUBE_ENABLED=false"
} >>"$ENV_FILE"
fi
chmod 600 "$ENV_FILE"
}
+13 -1
View File
@@ -36,6 +36,17 @@ ensure_media_dir() {
mkdir -p "$p"
}
ensure_youtube_dir() {
# YOUTUBE_COOKIES_HOST_PATH is only present when the YouTube source is
# enabled; create the folder so the bind mount has a real host directory
# (the user drops cookies.txt into it later).
local p
p="$(grep -E '^YOUTUBE_COOKIES_HOST_PATH=' "$ENV_FILE" | cut -d= -f2-)"
[[ -n "$p" ]] || return 0
[[ "$p" = /* ]] || p="${BOOTSTRAP_DIR}/${p#./}"
mkdir -p "$p"
}
lifecycle_pull() {
ui_info "$(t pull_images "$(grep -E '^MCMA_IMAGE_TAG=' "$ENV_FILE" | cut -d= -f2-)")"
ui_dim "$(t pull_hint)"
@@ -64,6 +75,7 @@ sys.exit(1)
lifecycle_start() {
local create_admin="${1:-no}"
ensure_media_dir
ensure_youtube_dir
lifecycle_pull
local deps; deps="$(backing_services)"
@@ -111,7 +123,7 @@ lifecycle_update() {
ui_ok "$(t done_title)"
}
lifecycle_up() { ensure_media_dir; dc up -d; }
lifecycle_up() { ensure_media_dir; ensure_youtube_dir; dc up -d; }
lifecycle_down() { dc down; }
lifecycle_logs() { dc logs -f --tail=100; }