cicy-desktop 2.1.49 → 2.1.50
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-Bmh5r-UU.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/index-BowhPJHl.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -439,11 +439,13 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
439
439
|
if (onRename && next && next !== team.name) await onRename(team.id, next);
|
|
440
440
|
};
|
|
441
441
|
|
|
442
|
-
//
|
|
443
|
-
//
|
|
444
|
-
//
|
|
445
|
-
//
|
|
446
|
-
|
|
442
|
+
// Lifecycle (启动 / 重启 / 更新 / 停止) acts on the daemon the desktop OWNS —
|
|
443
|
+
// localhost on the sidecar port (:8008). A remote node or a non-8008 port
|
|
444
|
+
// can't be controlled from here (sidecar.* would hit the wrong, local :8008),
|
|
445
|
+
// so those cards get 打开 only — no ⋯ menu, no update prompt. 打开 stays the
|
|
446
|
+
// one primary action; maintenance lives in the ⋯ menu.
|
|
447
|
+
const hasBridge = !!window.cicy?.sidecar?.restart;
|
|
448
|
+
const local = hasBridge && isLocalSidecar(team.base_url);
|
|
447
449
|
const running = team.status === "running";
|
|
448
450
|
const [busy, setBusy] = useState(""); // "" | start | restart | update | stop
|
|
449
451
|
const [opMsg, setOpMsg] = useState("");
|
|
@@ -455,17 +457,17 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
455
457
|
// exists (no nagging when current). Renderer-side via cloud.fetch — main
|
|
456
458
|
// proxies it, dodging CORS; no extra IPC needed.
|
|
457
459
|
useEffect(() => {
|
|
458
|
-
if (!
|
|
460
|
+
if (!local || !window.cicy?.cloud?.fetch) return;
|
|
459
461
|
let alive = true;
|
|
460
462
|
window.cicy.cloud
|
|
461
463
|
.fetch("https://registry.npmmirror.com/cicy-code/latest")
|
|
462
464
|
.then((r) => { if (alive && r?.ok) { try { setLatest(JSON.parse(r.body)?.version || null); } catch {} } })
|
|
463
465
|
.catch(() => {});
|
|
464
466
|
return () => { alive = false; };
|
|
465
|
-
}, [
|
|
467
|
+
}, [local]);
|
|
466
468
|
|
|
467
|
-
const updateAvailable = !!(latest && team.version && cmpVer(latest, team.version) > 0);
|
|
468
|
-
const showMenu =
|
|
469
|
+
const updateAvailable = !!(local && latest && team.version && cmpVer(latest, team.version) > 0);
|
|
470
|
+
const showMenu = local && (running || updateAvailable);
|
|
469
471
|
|
|
470
472
|
useEffect(() => {
|
|
471
473
|
if (!menuOpen) return;
|
|
@@ -492,18 +494,13 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
492
494
|
};
|
|
493
495
|
const BUSY_LABEL = { start: "启动中…", restart: "重启中…", update: "更新中…", stop: "停止中…" };
|
|
494
496
|
|
|
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
497
|
// 打开 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
|
|
503
|
-
// daemon is down we start it first;
|
|
498
|
+
// it just opens the window. health is an indicator, not a gate. When the
|
|
499
|
+
// LOCAL daemon is down we start it first; remote/other-port teams just open
|
|
500
|
+
// and let the loaded page show its own connecting/login/error UI.
|
|
504
501
|
const handleOpen = async () => {
|
|
505
502
|
if (busy) return;
|
|
506
|
-
if (!running &&
|
|
503
|
+
if (!running && local && window.cicy?.sidecar?.start) {
|
|
507
504
|
setBusy("start"); setOpMsg("");
|
|
508
505
|
const r = await window.cicy.sidecar.start().catch((e) => ({ ok: false, error: e?.message || String(e) }));
|
|
509
506
|
setBusy(""); onRefresh?.();
|
|
@@ -516,9 +513,7 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
516
513
|
};
|
|
517
514
|
const openLabel = running
|
|
518
515
|
? tr("localTeams.open", "打开")
|
|
519
|
-
:
|
|
520
|
-
? tr("localTeams.startOpen", "启动并打开")
|
|
521
|
-
: tr("localTeams.open", "打开");
|
|
516
|
+
: tr("localTeams.startOpen", "启动并打开");
|
|
522
517
|
return (
|
|
523
518
|
<div data-id="LocalTeamCard" className={`bcard bcard--local${tone === "ok" ? " bcard--online" : ""}`}>
|
|
524
519
|
<div className="bcard__accent" />
|
|
@@ -604,8 +599,6 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
604
599
|
{team.base_url || "—"}
|
|
605
600
|
</div>
|
|
606
601
|
<div className="bcard__meta">
|
|
607
|
-
<span className="bcard__chip">{statusInfo.label}</span>
|
|
608
|
-
{team.version && <span className="bcard__chip">v{team.version}</span>}
|
|
609
602
|
{updateAvailable && (
|
|
610
603
|
<span
|
|
611
604
|
className="bcard__chip bcard__chip--new"
|
|
@@ -616,11 +609,6 @@ function LocalTeamCard({ team, onOpen, onRename, onRefresh }) {
|
|
|
616
609
|
</span>
|
|
617
610
|
)}
|
|
618
611
|
</div>
|
|
619
|
-
{(busy || opMsg) && (
|
|
620
|
-
<div className="bcard__opmsg" data-id="LocalTeamCard-opmsg">
|
|
621
|
-
{busy ? <><Spinner />{BUSY_LABEL[busy] || tr("sidecar.working", "处理中…")}</> : opMsg}
|
|
622
|
-
</div>
|
|
623
|
-
)}
|
|
624
612
|
</div>
|
|
625
613
|
<button
|
|
626
614
|
type="button"
|