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
+32
View File
@@ -111,6 +111,38 @@ class ChromeTests(TempDirMixin, unittest.TestCase):
self.assert_removed(temp_dir)
def test_create_shortcut_writes_lnk_with_required_chrome_arguments(self):
with self.make_temp_dir() as temp_dir:
chrome_path = os.path.join(temp_dir, "Chrome App", "chrome.exe")
shortcut_path = os.path.join(temp_dir, "Desktop", "主店.lnk")
account = {
"alias": "alias",
"debug_port": 9222,
"user_data_dir": os.path.join(temp_dir, "profile with space"),
}
cfg = {"chrome_path": chrome_path}
with mock.patch("app.chrome.subprocess.run") as run:
result = chrome.create_shortcut(
account,
shortcut_path=shortcut_path,
config=cfg,
)
self.assertEqual(os.path.abspath(shortcut_path), result)
run.assert_called_once()
command = run.call_args[0][0]
self.assertEqual("powershell", command[0])
script = command[-1]
self.assertIn("$shortcut.TargetPath", script)
self.assertIn(chrome_path, script)
self.assertIn("--remote-debugging-port=9222", script)
self.assertIn("--remote-allow-origins=*", script)
self.assertIn("--user-data-dir=", script)
self.assertIn("profile with space", script)
self.assert_removed(temp_dir)
def test_is_running_and_wait_debug_ready(self):
port = self.start_json_version_server()