refactored config plugin defintions
This commit is contained in:
@@ -69,6 +69,7 @@ class PlaywrightDefaults:
|
||||
viewport_height: int = 1080
|
||||
navigation_timeout_ms: int = 90_000
|
||||
ignore_https_errors: bool = True
|
||||
screenshot_quality: int = 8
|
||||
ffmpeg_path: Optional[str] = None # Path to ffmpeg executable; auto-detected if None
|
||||
|
||||
|
||||
@@ -107,6 +108,7 @@ class PlaywrightTool:
|
||||
- playwright.viewport_height=1200
|
||||
- playwright.navigation_timeout_ms=90000
|
||||
- playwright.ignore_https_errors=true
|
||||
- playwright.screenshot_quality=8
|
||||
- playwright.ffmpeg_path="/path/to/ffmpeg" (auto-detected if not set)
|
||||
|
||||
FFmpeg resolution (in order):
|
||||
@@ -176,6 +178,7 @@ class PlaywrightTool:
|
||||
vw = _int("viewport_width", defaults.viewport_width)
|
||||
vh = _int("viewport_height", defaults.viewport_height)
|
||||
nav_timeout = _int("navigation_timeout_ms", defaults.navigation_timeout_ms)
|
||||
screenshot_quality = max(1, min(10, _int("screenshot_quality", defaults.screenshot_quality)))
|
||||
|
||||
ignore_https = bool(_get("ignore_https_errors", defaults.ignore_https_errors))
|
||||
|
||||
@@ -231,6 +234,7 @@ class PlaywrightTool:
|
||||
viewport_height=vh,
|
||||
navigation_timeout_ms=nav_timeout,
|
||||
ignore_https_errors=ignore_https,
|
||||
screenshot_quality=screenshot_quality,
|
||||
ffmpeg_path=ffmpeg_path,
|
||||
)
|
||||
|
||||
@@ -578,52 +582,77 @@ def config_schema() -> List[Dict[str, Any]]:
|
||||
{
|
||||
"key": "browser",
|
||||
"label": "Playwright browser",
|
||||
"group": "Browser",
|
||||
"default": _defaults.browser,
|
||||
"choices": browser_choices,
|
||||
},
|
||||
{
|
||||
"key": "headless",
|
||||
"label": "Headless",
|
||||
"group": "Browser",
|
||||
"type": "boolean",
|
||||
"default": str(_defaults.headless),
|
||||
"choices": ["true", "false"],
|
||||
},
|
||||
{
|
||||
"key": "user_agent",
|
||||
"label": "User Agent",
|
||||
"group": "Browser",
|
||||
"default": "default",
|
||||
"choices": ["default", "native", "custom"],
|
||||
},
|
||||
{
|
||||
"key": "user_agent_custom",
|
||||
"label": "Custom User Agent (used when User Agent = custom)",
|
||||
"group": "Browser",
|
||||
"default": "",
|
||||
"placeholder": "Mozilla/5.0 ...",
|
||||
},
|
||||
{
|
||||
"key": "viewport_width",
|
||||
"label": "Viewport width",
|
||||
"group": "Capture",
|
||||
"type": "integer",
|
||||
"default": _defaults.viewport_width,
|
||||
"choices": viewport_width_choices,
|
||||
},
|
||||
{
|
||||
"key": "viewport_height",
|
||||
"label": "Viewport height",
|
||||
"group": "Capture",
|
||||
"type": "integer",
|
||||
"default": _defaults.viewport_height,
|
||||
"choices": viewport_height_choices,
|
||||
},
|
||||
{
|
||||
"key": "navigation_timeout_ms",
|
||||
"label": "Navigation timeout (ms)",
|
||||
"group": "Navigation",
|
||||
"type": "integer",
|
||||
"default": _defaults.navigation_timeout_ms,
|
||||
},
|
||||
{
|
||||
"key": "screenshot_quality",
|
||||
"label": "Default screenshot quality",
|
||||
"group": "Capture",
|
||||
"type": "integer",
|
||||
"default": _defaults.screenshot_quality,
|
||||
"choices": list(range(1, 11)),
|
||||
},
|
||||
{
|
||||
"key": "ignore_https_errors",
|
||||
"label": "Ignore HTTPS errors",
|
||||
"group": "Navigation",
|
||||
"type": "boolean",
|
||||
"default": str(_defaults.ignore_https_errors),
|
||||
"choices": ["true", "false"],
|
||||
},
|
||||
{
|
||||
"key": "ffmpeg_path",
|
||||
"label": "FFmpeg path (leave empty to use global/bundled)",
|
||||
"group": "Environment",
|
||||
"type": "path",
|
||||
"default": "",
|
||||
"placeholder": "C:/path/to/ffmpeg.exe",
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user