e833b923c8
接入 Playwright Worker、会话 WebSocket 与全局浏览器面板(固定于 App Bar 下); 含验证码 stealth、设置项默认音与 URL 安全校验;附带 worker 部署与设计文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
726 B
Python
23 lines
726 B
Python
"""Browser Worker configuration."""
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class WorkerSettings(BaseSettings):
|
|
WORKER_SECRET: str = ""
|
|
WORKER_BIND: str = "0.0.0.0:8443"
|
|
WORKER_MAX_SESSIONS: int = 2
|
|
WORKER_IDLE_TIMEOUT_SEC: int = 1800
|
|
# POST /v1/sessions without WS attach — reclaim zombie reservations
|
|
WORKER_RESERVE_TIMEOUT_SEC: int = 120
|
|
# false + Xvfb — better for 阿里云等验证码;true 省资源
|
|
WORKER_HEADLESS: str = "false"
|
|
WORKER_SCREENCAST_QUALITY: int = 90
|
|
WORKER_DEFAULT_VIEWPORT_W: int = 1280
|
|
WORKER_DEFAULT_VIEWPORT_H: int = 720
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
|
|
settings = WorkerSettings()
|