chore: auto release commit (2026-06-19 09:53:29)
All checks were successful
技能自动化发布 / release (push) Successful in 7s
All checks were successful
技能自动化发布 / release (push) Successful in 7s
This commit is contained in:
@@ -13,8 +13,8 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from db.connection import init_db
|
||||
from db.accounts_repo import get_account_by_id
|
||||
from db.connection import get_conn, init_db
|
||||
from db.accounts_repo import get_account_by_id, get_platform_from_db
|
||||
from util.logging_config import (
|
||||
get_skill_logger,
|
||||
subprocess_env_with_trace,
|
||||
@@ -74,6 +74,31 @@ def _print_browser_install_hint():
|
||||
print(" • Edge: https://www.microsoft.com/zh-cn/edge")
|
||||
|
||||
|
||||
def resolve_account_browser_url(account: dict, conn=None) -> str:
|
||||
"""account.url 优先,其次 platforms 表 default_url,最后内置 PLATFORMS。"""
|
||||
url = (account.get("url") or "").strip()
|
||||
if url:
|
||||
return url
|
||||
pk = (account.get("platform_key") or "").strip()
|
||||
if not pk:
|
||||
return ""
|
||||
|
||||
close_conn = False
|
||||
if conn is None:
|
||||
init_db()
|
||||
conn = get_conn()
|
||||
close_conn = True
|
||||
try:
|
||||
plat = get_platform_from_db(conn, pk)
|
||||
if plat and (plat.get("default_url") or "").strip():
|
||||
return plat["default_url"].strip()
|
||||
finally:
|
||||
if close_conn:
|
||||
conn.close()
|
||||
|
||||
return (PLATFORMS.get(pk, {}).get("default_url") or "").strip()
|
||||
|
||||
|
||||
def cmd_open(account_id):
|
||||
"""
|
||||
打开该账号的持久化浏览器,仅用于肉眼核对。
|
||||
@@ -109,9 +134,11 @@ def cmd_open(account_id):
|
||||
return
|
||||
os.makedirs(profile_dir, exist_ok=True)
|
||||
|
||||
# Use account url, fall back to platform default
|
||||
platform_spec = PLATFORMS.get(target["platform_key"], {})
|
||||
url = (target.get("url") or "").strip() or platform_spec.get("default_url", "")
|
||||
conn = get_conn()
|
||||
try:
|
||||
url = resolve_account_browser_url(target, conn=conn)
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
log.info(
|
||||
"browser_open_context profile_dir=%s url=%s channel=%s platform=%s",
|
||||
|
||||
Reference in New Issue
Block a user