fix: open account browser maximized without Chrome first-run
All checks were successful
技能自动化发布 / release (push) Successful in 5s
All checks were successful
技能自动化发布 / release (push) Successful in 5s
Human open now uses start-maximized and no-first-run flags, and profile shortcuts share the same args plus the platform URL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -162,7 +162,9 @@ def create_web_account_record(
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
shortcut_path = create_profile_browser_shortcut(resolved_profile_dir, safe_label, log)
|
||||
shortcut_path = create_profile_browser_shortcut(
|
||||
resolved_profile_dir, safe_label, log, url=resolved_url,
|
||||
)
|
||||
|
||||
log.info("account_add_web_success id=%s platform=%s profile_dir=%s", new_id, key, resolved_profile_dir)
|
||||
ok_payload = {
|
||||
|
||||
@@ -75,6 +75,35 @@ def resolve_chromium_channel():
|
||||
return "chrome"
|
||||
|
||||
|
||||
# 给人核对/手工登录用:跳过 Chrome 首次欢迎页并最大化。不要带 Playwright 的 --enable-automation。
|
||||
HUMAN_CHROME_FLAGS = (
|
||||
"--start-maximized",
|
||||
"--no-first-run",
|
||||
"--no-default-browser-check",
|
||||
"--disable-search-engine-choice-screen",
|
||||
)
|
||||
|
||||
|
||||
def human_chrome_launch_args(profile_dir, url=None):
|
||||
"""chrome.exe 之后的参数(Popen 列表形式,路径不额外加引号)。"""
|
||||
profile_abs = os.path.abspath(profile_dir)
|
||||
args = [f"--user-data-dir={profile_abs}", *HUMAN_CHROME_FLAGS]
|
||||
cleaned = (url or "").strip()
|
||||
if cleaned:
|
||||
args.append(cleaned)
|
||||
return args
|
||||
|
||||
|
||||
def human_chrome_shortcut_arguments(profile_dir, url=None):
|
||||
"""Windows .lnk Arguments 字符串(user-data-dir 带引号)。"""
|
||||
profile_abs = os.path.abspath(profile_dir)
|
||||
parts = [f'--user-data-dir="{profile_abs}"', *HUMAN_CHROME_FLAGS]
|
||||
cleaned = (url or "").strip()
|
||||
if cleaned:
|
||||
parts.append(cleaned)
|
||||
return " ".join(parts)
|
||||
|
||||
|
||||
def _print_browser_install_hint():
|
||||
print("❌ 未检测到 Google Chrome 或 Microsoft Edge,请先安装:")
|
||||
print(" • Chrome: https://www.google.com/chrome/")
|
||||
@@ -164,9 +193,9 @@ def cmd_reveal_profile(account_id):
|
||||
|
||||
def cmd_open(account_id):
|
||||
"""
|
||||
打开该账号的持久化浏览器,仅用于肉眼核对。
|
||||
打开该账号的持久化浏览器,仅用于肉眼核对 / 手工登录 / 抓 DOM。
|
||||
与 reveal-profile 同模式:本进程直接拉起系统 Chrome/Edge 后立即返回。
|
||||
不写数据库、不判定是否已登录、不起 Playwright / 额外 python 子进程。
|
||||
最大化、跳过 Chrome 首次欢迎页;不写数据库、不判定是否已登录、不起 Playwright。
|
||||
"""
|
||||
log = get_skill_logger()
|
||||
init_db()
|
||||
@@ -202,10 +231,8 @@ def cmd_open(account_id):
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
# 与 profile_shortcut 一致:独立 user-data-dir 保存登录态
|
||||
cmd = [browser_exe, f"--user-data-dir={profile_abs}"]
|
||||
if url:
|
||||
cmd.append(url)
|
||||
# 与 profile_shortcut 同一套人用参数:独立 user-data-dir 保存登录态
|
||||
cmd = [browser_exe, *human_chrome_launch_args(profile_abs, url)]
|
||||
|
||||
log.info(
|
||||
"browser_open_launch exe=%s profile_dir=%s url=%s platform=%s",
|
||||
|
||||
Reference in New Issue
Block a user