cicy-desktop 2.1.144 → 2.1.145

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.144",
3
+ "version": "2.1.145",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -360,6 +360,18 @@ function curlDownload(url, dest, { emit, phase = "image", label = "下载镜像"
360
360
  // (much faster here); falls back to the node downloader if curl is unavailable.
361
361
  async function downloadImageTarball({ emit } = {}) {
362
362
  const dest = imageTarballPath();
363
+ // REUSE a complete tarball already on disk (staged into ~/Downloads, or a prior
364
+ // run) BEFORE curlDownload touches it — curlDownload doesn't skip a complete file
365
+ // (and a failed curl truncates it). headSize uses node http so it works even when
366
+ // curl can't resolve the host. Skips the ~500MB re-download per new user.
367
+ try {
368
+ const expected = await headSize(R2_TARBALL);
369
+ const have = fs.statSync(dest).size;
370
+ if (expected > 0 && have === expected) {
371
+ emit && emit({ phase: "image", status: "skip", message: "镜像:已有完整包,跳过下载", progress: 100, received: have, total: expected });
372
+ return dest;
373
+ }
374
+ } catch {}
363
375
  try { await curlDownload(R2_TARBALL, dest, { emit, phase: "image", label: "下载镜像" }); }
364
376
  catch (e) {
365
377
  emit && emit({ phase: "image", status: "running", message: `curl 下载失败(${e.message}),改用内置下载…` });