cicy-desktop 2.1.112 → 2.1.113
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 +1 -1
- package/src/sidecar/wsl-docker.js +19 -10
package/package.json
CHANGED
|
@@ -387,18 +387,27 @@ async function restart({ container = "cicy-code-docker", port = 8009 } = {}) {
|
|
|
387
387
|
async function stop({ container = "cicy-code-docker" } = {}) {
|
|
388
388
|
try { await wslRun(`docker stop ${container}`, { timeout: 30000 }); } catch {}
|
|
389
389
|
}
|
|
390
|
+
// Unregister the dedicated distro (idempotent; no-op if absent). Used by upgrade
|
|
391
|
+
// to wipe a stale install before re-importing the latest pre-baked package.
|
|
392
|
+
function unregisterDistro() {
|
|
393
|
+
return new Promise((resolve) => {
|
|
394
|
+
execFile("wsl", ["--unregister", DISTRO], { timeout: 120000, windowsHide: true }, () => resolve());
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Upgrade = re-import the latest pre-baked 烤制包 (it carries the latest cicy-code
|
|
399
|
+
// image). DockerHub `docker pull` is unreliable in CN, and the standalone image
|
|
400
|
+
// `docker save` tarball was retired — so re-import (via the app's own resilient
|
|
401
|
+
// downloader, which copes with the flaky CN DNS that bare curl can't) is the
|
|
402
|
+
// only reliable CN update path. This RESETS the distro: the cicy-team volume is
|
|
403
|
+
// re-created and the instance re-seeds (new token) on next boot.
|
|
390
404
|
async function upgrade({ onProgress, port = 8009, container = "cicy-code-docker", volume = "cicy-team", env = {} } = {}) {
|
|
391
405
|
const emit = (ev) => { try { onProgress && onProgress(ev); } catch {} };
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
try { await stop({ container }); await runContainer({ port, container, volume, env }); }
|
|
398
|
-
catch (e) { emit({ phase: "done", status: "error", message: `容器启动失败:${e.message}` }); return { ok: false, reason: "container_start_failed" }; }
|
|
399
|
-
const healthy = await docker.waitUntil(() => probeHealth(port), { totalMs: 120000, everyMs: 3000 });
|
|
400
|
-
emit({ phase: "done", status: healthy ? "done" : "error", message: healthy ? "升级完成 🎉" : `启动了但 :${port} 还没响应` });
|
|
401
|
-
return { ok: healthy };
|
|
406
|
+
emit({ phase: "install-docker", status: "running", message: "升级 = 拉取最新运行环境并重装(会重置容器数据)…" });
|
|
407
|
+
try { await stop({ container }); } catch {}
|
|
408
|
+
try { await unregisterDistro(); } catch {}
|
|
409
|
+
// Reuse the robust one-shot install flow (download → import → dockerd → run).
|
|
410
|
+
return await _bootstrap({ onProgress, port, container, volume, env });
|
|
402
411
|
}
|
|
403
412
|
|
|
404
413
|
module.exports = {
|