From 9b125bf9b0cc25209c4223091b5770948cfb493a Mon Sep 17 00:00:00 2001 From: ixff <150003322+ixff@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:20:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9Pla?= =?UTF-8?q?ywright=E6=B5=8F=E8=A7=88=E5=99=A8=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 ++ app/helper/browser.py | 2 +- docker/Dockerfile | 1 + docker/entrypoint.sh | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index ef1235f9..394d259e 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -407,6 +407,8 @@ class ConfigModel(BaseModel): # ==================== Docker配置 ==================== # Docker Client API地址 DOCKER_CLIENT_API: Optional[str] = "tcp://127.0.0.1:38379" + # Playwright浏览器类型,chromium/firefox + PLAYWRIGHT_BROWSER_TYPE: str = "chromium" # ==================== AI智能体配置 ==================== # AI智能体开关 diff --git a/app/helper/browser.py b/app/helper/browser.py index 9062a427..c9420d53 100644 --- a/app/helper/browser.py +++ b/app/helper/browser.py @@ -10,7 +10,7 @@ from app.utils.http import RequestUtils, cookie_parse class PlaywrightHelper: - def __init__(self, browser_type="chromium"): + def __init__(self, browser_type=settings.PLAYWRIGHT_BROWSER_TYPE): self.browser_type = browser_type @staticmethod diff --git a/docker/Dockerfile b/docker/Dockerfile index ab47e5b9..b3f89d81 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -94,6 +94,7 @@ COPY --from=prepare_venv --chmod=777 ${VENV_PATH} ${VENV_PATH} # playwright 环境 RUN playwright install-deps chromium \ + && playwright install-deps firefox \ && apt-get autoremove -y \ && apt-get clean \ && rm -rf \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 2ea27544..fa0d24f9 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -231,9 +231,9 @@ chown moviepilot:moviepilot /etc/hosts /tmp # 下载浏览器内核 if [[ "$HTTPS_PROXY" =~ ^https?:// ]] || [[ "$HTTPS_PROXY" =~ ^https?:// ]] || [[ "$PROXY_HOST" =~ ^https?:// ]]; then - HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-$PROXY_HOST}}" gosu moviepilot:moviepilot playwright install chromium + HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-$PROXY_HOST}}" gosu moviepilot:moviepilot playwright install ${PLAYWRIGHT_BROWSER_TYPE:-chromium} else - gosu moviepilot:moviepilot playwright install chromium + gosu moviepilot:moviepilot playwright install ${PLAYWRIGHT_BROWSER_TYPE:-chromium} fi # 证书管理