Playwright headless 设置

在 Suan API 设置中添加控制 playwright headless 模式的设置。
This commit is contained in:
2026-04-21 17:53:20 +08:00
parent 16bd8e9f9a
commit 06d4b605b1
4 changed files with 11 additions and 1 deletions

View File

@@ -61,6 +61,7 @@ class Config:
doc_system["port"] = 8000
doc_system["reload"] = True
doc_schedule["playwright_headless"] = True
doc_schedule["jwxt_login_method"] = "sso"
doc_schedule["semester_start_date"] = "2026-03-02"
doc_schedule["schedule_title_template"] = "芒果酸的第 {title} 周课程表"

View File

@@ -6,6 +6,8 @@ from playwright.async_api import (
async_playwright,
)
from . import config
class PlayContextManager:
def __init__(
@@ -26,7 +28,7 @@ class PlayContextManager:
"""手动启动"""
self.playwright = await async_playwright().start() # 不是 __enter__
self.browser = await self.playwright.chromium.launch(
headless=False,
headless=config.get("schedule", "playwright_headless", True),
args=[
"--disable-blink-features=AutomationControlled",
"--no-sandbox",