feat: 完成账号桌面快捷方式
- 新增 chrome.create_shortcut 使用 PowerShell WScript.Shell 生成 .lnk - 快捷方式参数复用 Chrome 启动参数,包含调试端口、allow-origins 和账号 user-data-dir - 在账号服务层和 Tab④ 增加快捷方式入口,不包含密码或密钥 - 补充 chrome/accounts/gui 测试并同步任务、API、路由、当前状态和进度文档
This commit is contained in:
+7
-3
@@ -140,6 +140,8 @@ update_account(original_alias, account_name, alias, region_host=None, debug_port
|
||||
password=None, note=None, path=None, config=None) -> db.Account
|
||||
delete_account(alias, path=None, config=None) -> None
|
||||
launch_for_login(account_or_alias, path=None, config=None) -> subprocess.Popen
|
||||
create_shortcut(account_or_alias, shortcut_path=None, desktop_dir=None,
|
||||
path=None, config=None) -> str
|
||||
detect_login(account_or_alias, timeout=8, path=None, config=None) -> dict
|
||||
login_status_text(status) -> str
|
||||
```
|
||||
@@ -150,6 +152,7 @@ login_status_text(status) -> str
|
||||
- `debug_port` 在账号服务层按账号唯一校验;默认端口取 `debug_port_range` 中第一个未占用端口。
|
||||
- `delete_account()` 只删除 DB 账号记录,不删除本地 user-data-dir,避免误删登录态。
|
||||
- `launch_for_login()` 只启动带该账号 user-data-dir 和 CDP 端口的 Chrome;不会读取、填写或提交密码。
|
||||
- `create_shortcut()` 生成 `.lnk`,目标/参数复用 `chrome.build_launch_args()`,不包含密码。
|
||||
- `detect_login()` 复用 `editor.login_status()`;检测为已登录时更新 `last_login_at`。
|
||||
|
||||
## chrome 模块(`app/chrome.py`,已建)
|
||||
@@ -159,11 +162,12 @@ class ChromeLaunchError(RuntimeError): ...
|
||||
build_launch_args(account, config=None) -> list[str]
|
||||
# chrome + --remote-debugging-port + --remote-allow-origins=* + --user-data-dir
|
||||
launch_chrome(account, config=None) -> subprocess.Popen
|
||||
create_shortcut(account, shortcut_path=None, desktop_dir=None, name=None, config=None) -> str
|
||||
wait_debug_ready(port, timeout=60, host="127.0.0.1") -> bool
|
||||
is_running(port, host="127.0.0.1") -> bool
|
||||
```
|
||||
|
||||
`build_launch_args()` 接受 dict 或对象形式账号;账号需有 `debug_port`,并有 `user_data_dir` 或 `slug/alias`。端口探测访问 `/json/version`,显式禁用环境代理。`.lnk` 快捷方式留给 T-106。
|
||||
`build_launch_args()` 接受 dict 或对象形式账号;账号需有 `debug_port`,并有 `user_data_dir` 或 `slug/alias`。端口探测访问 `/json/version`,显式禁用环境代理。`create_shortcut()` 使用 PowerShell `WScript.Shell.CreateShortcut` 生成 `.lnk`,`TargetPath` 为 Chrome,`Arguments` 含 `--remote-debugging-port`、`--remote-allow-origins=*`、`--user-data-dir=<该账号目录>`。
|
||||
|
||||
## cdp 模块(`app/cdp.py`,T-000 由根目录 `cdp.py` 迁入)
|
||||
|
||||
@@ -251,7 +255,7 @@ render_prompt(template_text, task) -> str
|
||||
# GUI 入口
|
||||
main() -> int # 创建 QApplication + MainWindow
|
||||
class MainWindow(QMainWindow) # QTabWidget: ①②③④⑤;支持注入 db_path/config 便于测试
|
||||
class AccountsTab(QWidget) # ④ 账号管理:表格 + 增删改 + 启动登录 + 检测登录
|
||||
class AccountsTab(QWidget) # ④ 账号管理:表格 + 增删改 + 启动登录 + 检测登录 + 快捷方式
|
||||
class AccountDialog(QDialog) # 账号编辑弹窗;密码 QLineEdit.Password
|
||||
TAB_TITLES: list[str] # 固定 Tab 顺序
|
||||
TAB_STYLE: str # 顶层 Tab 栏防误点样式:最小宽度/padding/间距/当前态
|
||||
@@ -265,7 +269,7 @@ TAB_STYLE: str # 顶层 Tab 栏防误点样式:
|
||||
|
||||
- 表格列:账号名、别名、地区、端口、登录状态、备注;不展示密码。
|
||||
- 弹窗字段:账号名、别名、地区、调试端口、密码、备注、slug、数据目录;密码框使用打码显示。
|
||||
- 「启动登录」只启动 Chrome,人工登录;「检测登录」用 worker 跑 `accounts.detect_login()` 并刷新状态列。
|
||||
- 「启动登录」只启动 Chrome,人工登录;「检测登录」用 worker 跑 `accounts.detect_login()` 并刷新状态列;「快捷方式」调用 `accounts.create_shortcut()` 生成默认桌面 `.lnk`。
|
||||
|
||||
## workers 模块(`app/workers.py`,已建,PySide6)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user