cicy-desktop 2.1.232 → 2.1.234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -543,6 +543,20 @@ function projectsMountArg() {
|
|
|
543
543
|
} catch (e) { log.warn(`[wsl-docker] projects mount setup failed: ${e.message}`); return ""; }
|
|
544
544
|
}
|
|
545
545
|
|
|
546
|
+
// 把 Windows 的每个盘都挂进容器 —— **动态枚举,不写死盘符**:`ls /mnt` 拿 WSL 已自动挂载的
|
|
547
|
+
// 单字母目录(c/d/e…,有几个挂几个),逐盘 `-v /mnt/<x>:/mnt/<x>`。逐盘而非整挂 /mnt,是为了
|
|
548
|
+
// 避开 /mnt/wsl 等非盘目录。USB/可移动盘 WSL 默认不自动挂进 /mnt,天然不在此列(主人:不用管 usb)。
|
|
549
|
+
async function allDrivesMountArg() {
|
|
550
|
+
try {
|
|
551
|
+
const { stdout } = await wslRun("ls -1 /mnt 2>/dev/null", { timeout: 10000 });
|
|
552
|
+
const drives = String(stdout || "")
|
|
553
|
+
.split(/\r?\n/)
|
|
554
|
+
.map((s) => s.trim())
|
|
555
|
+
.filter((s) => /^[a-z]$/i.test(s)); // 只取单字母盘符,排除 wsl 等
|
|
556
|
+
return drives.map((d) => `-v /mnt/${d}:/mnt/${d}`).join(" ");
|
|
557
|
+
} catch (e) { log.warn(`[wsl-docker] enumerate drives failed: ${e.message}`); return ""; }
|
|
558
|
+
}
|
|
559
|
+
|
|
546
560
|
// extraPorts → additional `-p 127.0.0.1:<p>:<p>` mappings (host=container, loopback
|
|
547
561
|
// only). For container-internal agent services the user wants reachable from
|
|
548
562
|
// Windows. Each adds one docker-proxy, so keep the list small. 8008/主端口自动排除。
|
|
@@ -581,7 +595,8 @@ async function runContainer({ port = 8008, container = "cicy-code-docker", volum
|
|
|
581
595
|
// 只发布 :8008(单端口,1 个 docker-proxy)。EXTRA_PORTS 那段 18000-19999(2000 个端口)
|
|
582
596
|
// 已删——docker 默认每端口起一个 userland-proxy 进程 → 2000 进程,docker run 卡死/吃内存/
|
|
583
597
|
// 偶发失败(实测)。容器内 agent 服务需要从 Windows 直达时再按需单独暴露。
|
|
584
|
-
const
|
|
598
|
+
const drivesArg = await allDrivesMountArg(); // 动态:有几个盘挂几个
|
|
599
|
+
const cmd = `docker run -d --name ${container} --restart unless-stopped --dns 223.5.5.5 --dns 8.8.8.8 ${publishArgs(port, extraPorts)} -e CICY_PUBLIC=1 -v ${volume}:/home/cicy ${projectsMountArg()} ${drivesArg} ${envArgs} ${IMAGE}`;
|
|
585
600
|
emit && emit({ phase: "container", status: "running", message: `$ ${cmd.length > 220 ? cmd.slice(0, 220) + " …" : cmd}` });
|
|
586
601
|
await wslRun(cmd, { timeout: 60000 }); // 失败时 err.stderr 带 docker 真错误 → _bootstrap 的 errTail 显示
|
|
587
602
|
ensureDesktopShortcut(volume, port).catch(() => {});
|
|
@@ -293,6 +293,12 @@ class TabManager {
|
|
|
293
293
|
return true;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
// 让窗口「可见但不抢前台」:已显示 → 什么都不做;隐藏 → showInactive(绝不 focus)。
|
|
297
|
+
// 程序化/agent 驱动的开 tab、reload、activate 都用它 —— win.focus() 只有在 cicy-desktop 不
|
|
298
|
+
// 在前台时才有效(= 从用户当前 app 抢焦点),用户在 cicy-desktop 内操作时它本就是 no-op。
|
|
299
|
+
// 所以这些非「用户明确要打开 app」的路径一律不抢焦点,避免用户在微信等窗口时被莫名跳到前台。
|
|
300
|
+
surfaceQuiet() { try { if (!this.win.isVisible()) this.win.showInactive(); } catch (e) {} }
|
|
301
|
+
|
|
296
302
|
close(id) {
|
|
297
303
|
const i = this.tabs.findIndex((x) => x.id === id);
|
|
298
304
|
if (i < 0) return false;
|
|
@@ -341,7 +347,7 @@ class TabManager {
|
|
|
341
347
|
if (ignoreCache) tab.view.webContents.reloadIgnoringCache();
|
|
342
348
|
else tab.view.webContents.reload();
|
|
343
349
|
} catch (e) {}
|
|
344
|
-
try { this.activate(tab.id); this.
|
|
350
|
+
try { this.activate(tab.id); this.surfaceQuiet(); } catch (e) {}
|
|
345
351
|
return true;
|
|
346
352
|
}
|
|
347
353
|
|
|
@@ -372,7 +378,7 @@ function findManagerByTab(webContentsId) {
|
|
|
372
378
|
async function openTab(accountIdx, url, opts = {}) {
|
|
373
379
|
const m = ensureManager(accountIdx);
|
|
374
380
|
const id = m.addTab(url, { trusted: !!opts.trusted, home: !!opts.home, title: opts.title || "", navigate: !!opts.navigate, avatar: opts.avatar || "", team: !!opts.team, colorKey: opts.colorKey || "" });
|
|
375
|
-
try { m.
|
|
381
|
+
try { m.surfaceQuiet(); } catch (e) {}
|
|
376
382
|
// 记下这个团队 tab 的 webContentsId(打开 → set;关闭/销毁 → delete)。
|
|
377
383
|
try {
|
|
378
384
|
const tab = m.tabs.find((t) => t.id === id);
|
|
@@ -401,7 +407,9 @@ function openHomeWindow(accountIdx, homeUrl, opts = {}) {
|
|
|
401
407
|
} else {
|
|
402
408
|
const id = m.addTab(homeUrl, { home: true }); tab = m.tabs.find((t) => t.id === id);
|
|
403
409
|
}
|
|
404
|
-
|
|
410
|
+
// 只有明确要求(tray「打开首页」/ 启动,activate!==false)才把窗口抢到前台;deeplink /
|
|
411
|
+
// second-instance 顺带触发(activate:false)只静默显示,绝不从用户当前 app 抢焦点。
|
|
412
|
+
if (opts.activate !== false) { try { m.win.show(); m.win.focus(); } catch (e) {} } else m.surfaceQuiet();
|
|
405
413
|
let wc = null; try { wc = tab ? tab.view.webContents : null; } catch (e) {}
|
|
406
414
|
return { win: m.win, wc };
|
|
407
415
|
}
|
|
@@ -462,7 +470,7 @@ function registerTabBrowserTools(registerTool) {
|
|
|
462
470
|
try {
|
|
463
471
|
const m = ensureManager(accountIdx);
|
|
464
472
|
if (m.tabs.length === 0 && accountIdx !== 0) m.addTab();
|
|
465
|
-
try { m.
|
|
473
|
+
try { m.surfaceQuiet(); } catch (e) {}
|
|
466
474
|
return ok({ success: true, accountIdx, winId: m.win.id });
|
|
467
475
|
} catch (e) { return ok({ error: e.message }, true); }
|
|
468
476
|
},
|
|
@@ -610,7 +618,7 @@ async function reloadTabByUrl(accountIdx, url, opts = {}) {
|
|
|
610
618
|
const tab = m.tabs.find((t) => stripVol(t.url) === key);
|
|
611
619
|
if (tab) {
|
|
612
620
|
try { tab.view.webContents.reload(); } catch (e) {}
|
|
613
|
-
try { m.activate(tab.id); m.
|
|
621
|
+
try { m.activate(tab.id); m.surfaceQuiet(); } catch (e) {}
|
|
614
622
|
return { ok: true, winId: m.win.id, reloaded: true };
|
|
615
623
|
}
|
|
616
624
|
}
|
|
@@ -633,7 +641,7 @@ function reloadTabIfOpen(accountIdx, url, opts = {}) {
|
|
|
633
641
|
if (mm && !mm.win.isDestroyed()) {
|
|
634
642
|
try {
|
|
635
643
|
const tab = mm.tabs.find((t) => { try { return t.view.webContents.id === wcId; } catch (e) { return false; } });
|
|
636
|
-
if (tab) { mm.activate(tab.id); mm.
|
|
644
|
+
if (tab) { mm.activate(tab.id); mm.surfaceQuiet(); }
|
|
637
645
|
} catch (e) {}
|
|
638
646
|
}
|
|
639
647
|
return { ok: true, winId: mm ? mm.win.id : undefined, reloaded: true, byWcId: true };
|
|
@@ -660,7 +668,7 @@ function activateTabIfOpen(accountIdx, url) {
|
|
|
660
668
|
if (mm && !mm.win.isDestroyed()) {
|
|
661
669
|
try {
|
|
662
670
|
const tab = mm.tabs.find((t) => { try { return t.view.webContents.id === wcId; } catch (e) { return false; } });
|
|
663
|
-
if (tab) { mm.activate(tab.id); mm.
|
|
671
|
+
if (tab) { mm.activate(tab.id); mm.surfaceQuiet(); return { ok: true, active: true }; }
|
|
664
672
|
} catch (e) {}
|
|
665
673
|
}
|
|
666
674
|
}
|