feat: 完成账号桌面快捷方式

- 新增 chrome.create_shortcut 使用 PowerShell WScript.Shell 生成 .lnk

- 快捷方式参数复用 Chrome 启动参数,包含调试端口、allow-origins 和账号 user-data-dir

- 在账号服务层和 Tab④ 增加快捷方式入口,不包含密码或密钥

- 补充 chrome/accounts/gui 测试并同步任务、API、路由、当前状态和进度文档
This commit is contained in:
chengma
2026-06-27 10:38:21 +08:00
parent 598df5f20b
commit 742193607b
11 changed files with 208 additions and 13 deletions
+23
View File
@@ -1,6 +1,7 @@
import unittest
import os
import sys
from unittest import mock
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
sys.path.insert(0, os.path.dirname(__file__))
@@ -126,6 +127,28 @@ class GuiTests(TempDirMixin, unittest.TestCase):
self.assert_removed(temp_dir)
def test_accounts_tab_create_shortcut_for_selected_account(self):
with self.make_temp_dir() as temp_dir:
cfg = self.make_config(temp_dir)
account = accounts.create_account("主店", "alias", debug_port=9222, config=cfg)
statuses = []
tab = AccountsTab(config=cfg, status_callback=statuses.append)
self.addCleanup(tab.close)
tab.table.selectRow(0)
shortcut_path = os.path.join(temp_dir, "Desktop", "主店.lnk")
with mock.patch(
"app.gui.accounts.create_shortcut",
return_value=shortcut_path,
) as create_shortcut, mock.patch("app.gui.QMessageBox.information") as info:
tab.create_shortcut()
create_shortcut.assert_called_once_with(account, config=cfg)
info.assert_called_once()
self.assertIn(shortcut_path, statuses[-1])
self.assert_removed(temp_dir)
if __name__ == "__main__":
unittest.main()