release: v1.0.50 playwright stealth gemini
All checks were successful
技能自动化发布 / release (push) Successful in 34s

This commit is contained in:
2026-04-07 15:18:14 +08:00
parent e2eafb7407
commit beb95c1415
6 changed files with 82 additions and 5 deletions

View File

@@ -16,6 +16,12 @@ _scripts_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if _scripts_dir not in sys.path:
sys.path.insert(0, _scripts_dir)
from util.playwright_stealth import (
STEALTH_INIT_SCRIPT,
persistent_context_launch_parts,
stealth_enabled,
)
def _is_context_closed_error(ex: BaseException) -> bool:
s = str(ex).lower()
@@ -224,13 +230,19 @@ def _run_login_child(c: dict) -> None:
with sync_playwright() as p:
try:
ctx = p.chromium.launch_persistent_context(
args, ignore_automation = persistent_context_launch_parts()
lc_kw = dict(
user_data_dir=profile_dir,
headless=False,
channel=c["channel"],
no_viewport=True,
args=["--start-maximized"],
args=args,
)
if ignore_automation is not None:
lc_kw["ignore_default_args"] = ignore_automation
ctx = p.chromium.launch_persistent_context(**lc_kw)
if stealth_enabled():
ctx.add_init_script(STEALTH_INIT_SCRIPT)
except Exception as e:
if _is_context_closed_error(e):
end_reason = "user_closed"