Playwright headless 设置
在 Suan API 设置中添加控制 playwright headless 模式的设置。
This commit is contained in:
@@ -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} 周课程表"
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user