diff --git a/backend/Dockerfile b/backend/Dockerfile index 71b9cf0..3601400 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -2,7 +2,9 @@ FROM python:3.12-slim WORKDIR /app -RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && \ + ln -sf /usr/bin/nodejs /usr/bin/node && \ + rm -rf /var/lib/apt/lists/* COPY backend/requirements.txt ./backend/requirements.txt RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp diff --git a/backend/routers/settings.py b/backend/routers/settings.py index 07ef79e..a0dcbc2 100644 --- a/backend/routers/settings.py +++ b/backend/routers/settings.py @@ -222,9 +222,26 @@ def oauth2_disable( def ytdlp_test( current_user: User = Depends(get_current_user), ): - """Run a quick yt-dlp metadata fetch on a public video and return raw output for diagnostics.""" - import subprocess + """Run a quick yt-dlp metadata fetch and environment check for diagnostics.""" + import subprocess, shutil cookie_args = ytdlp._cookie_args() + + node_path = shutil.which("node") or shutil.which("nodejs") + node_version = None + if node_path: + try: + nv = subprocess.run([node_path, "--version"], capture_output=True, text=True, timeout=5) + node_version = nv.stdout.strip() + except Exception: + pass + + yt_version = None + try: + yv = subprocess.run(["yt-dlp", "--version"], capture_output=True, text=True, timeout=5) + yt_version = yv.stdout.strip() + except Exception: + pass + result = subprocess.run( [ "yt-dlp", @@ -236,8 +253,11 @@ def ytdlp_test( capture_output=True, text=True, timeout=30, ) return { - "returncode": result.returncode, + "node_path": node_path, + "node_version": node_version, + "yt_dlp_version": yt_version, "cookie_args": cookie_args, + "returncode": result.returncode, "stdout_lines": result.stdout.splitlines()[:5], "stderr_tail": result.stderr.splitlines()[-20:], "success": result.returncode == 0,