cicy-desktop 2.1.48 → 2.1.49
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.
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>CiCy Desktop</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-CLpXv2cd.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/index-BowhPJHl.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -491,6 +491,34 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
const BUSY_LABEL = { start: "启动中…", restart: "重启中…", update: "更新中…", stop: "停止中…" };
|
|
494
|
+
|
|
495
|
+
// Can we bring this daemon up locally? Only the 127.0.0.1:8008 team is the
|
|
496
|
+
// sidecar we own — a remote node (or a non-8008 local port) can't be started
|
|
497
|
+
// from the desktop, so for those 打开 just opens the window and lets the
|
|
498
|
+
// loaded page show its own connecting/login/error UI.
|
|
499
|
+
const localSidecar = hasOps && isLocalSidecar(team.base_url);
|
|
500
|
+
|
|
501
|
+
// 打开 is NEVER gated on /api/health — openTeam() in main doesn't check it,
|
|
502
|
+
// it just opens the window. health is an indicator, not a gate. When a local
|
|
503
|
+
// daemon is down we start it first; otherwise we open and let the page cope.
|
|
504
|
+
const handleOpen = async () => {
|
|
505
|
+
if (busy) return;
|
|
506
|
+
if (!running && localSidecar && window.cicy?.sidecar?.start) {
|
|
507
|
+
setBusy("start"); setOpMsg("");
|
|
508
|
+
const r = await window.cicy.sidecar.start().catch((e) => ({ ok: false, error: e?.message || String(e) }));
|
|
509
|
+
setBusy(""); onRefresh?.();
|
|
510
|
+
if (!r?.ok || r?.warning) { // didn't come up — surface it, don't open a dead link
|
|
511
|
+
setOpMsg(tr("sidecar.startFailed", "启动失败") + (r?.error ? `: ${r.error}` : r?.warning ? `: ${r.warning}` : ""));
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
onOpen(); // open regardless of health — the window/page handles the rest
|
|
516
|
+
};
|
|
517
|
+
const openLabel = running
|
|
518
|
+
? tr("localTeams.open", "打开")
|
|
519
|
+
: localSidecar
|
|
520
|
+
? tr("localTeams.startOpen", "启动并打开")
|
|
521
|
+
: tr("localTeams.open", "打开");
|
|
494
522
|
return (
|
|
495
523
|
<div data-id="LocalTeamCard" className={`bcard bcard--local${tone === "ok" ? " bcard--online" : ""}`}>
|
|
496
524
|
<div className="bcard__accent" />
|
|
@@ -594,32 +622,30 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
594
622
|
</div>
|
|
595
623
|
)}
|
|
596
624
|
</div>
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
disabled={!!busy}
|
|
608
|
-
onClick={() => runOp("start", () => window.cicy.sidecar.start(), tr("sidecar.started", "已启动"))}
|
|
609
|
-
>
|
|
610
|
-
{busy === "start" ? <Spinner /> : <ArrowIcon />}
|
|
611
|
-
<span>{tr("sidecar.start", "启动")}</span>
|
|
612
|
-
</button>
|
|
613
|
-
) : (
|
|
614
|
-
<button type="button" className="bcard__cta" onClick={onOpen} disabled>
|
|
615
|
-
<ArrowIcon />
|
|
616
|
-
<span>{statusInfo.cta}</span>
|
|
617
|
-
</button>
|
|
618
|
-
)}
|
|
625
|
+
<button
|
|
626
|
+
type="button"
|
|
627
|
+
className="bcard__cta"
|
|
628
|
+
data-id="LocalTeamCard-open"
|
|
629
|
+
disabled={!!busy || !team.base_url}
|
|
630
|
+
onClick={handleOpen}
|
|
631
|
+
>
|
|
632
|
+
{busy === "start" ? <Spinner /> : <ArrowIcon />}
|
|
633
|
+
<span>{openLabel}</span>
|
|
634
|
+
</button>
|
|
619
635
|
</div>
|
|
620
636
|
);
|
|
621
637
|
}
|
|
622
638
|
|
|
639
|
+
// True only for the daemon the desktop actually owns — localhost on the
|
|
640
|
+
// sidecar port (8008). Remote nodes / other ports can't be started from here.
|
|
641
|
+
function isLocalSidecar(baseUrl) {
|
|
642
|
+
try {
|
|
643
|
+
const p = new URL(baseUrl);
|
|
644
|
+
const local = p.hostname === "127.0.0.1" || p.hostname === "localhost" || p.hostname === "::1";
|
|
645
|
+
return local && (p.port === "8008" || p.port === "");
|
|
646
|
+
} catch { return false; }
|
|
647
|
+
}
|
|
648
|
+
|
|
623
649
|
// Compare dotted versions: >0 if a newer than b, <0 older, 0 equal.
|
|
624
650
|
function cmpVer(a, b) {
|
|
625
651
|
const pa = String(a).split("."), pb = String(b).split(".");
|