cicy-desktop 2.1.262 → 2.1.264

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.262",
3
+ "version": "2.1.264",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -139,10 +139,10 @@
139
139
  "//optionalDependencies": "(2026-06 回调): mac/linux 改回 native cicy-code(:8008,colima 在 16G mac 上压垮内存)→ 重新内置 cicy-code-<plat> / cicy-mihomo-<plat>,localbin.fromBundle 零网络 seed(npm 仅作更新通道,带 npmmirror→npmjs 回退)。这些由 scripts/sync-runtime-deps.cjs 在 tag-push 时同步到最新版。npm 的 os/cpu 字段保证每个平台只装自己那份。Windows 仍走 docker(WSL :8009),它那份 cicy-code-windows 用不到但 bundle 着无害。",
140
140
  "optionalDependencies": {
141
141
  "electron": "41.0.3",
142
- "cicy-code-darwin-x64": "2.3.332",
143
- "cicy-code-darwin-arm64": "2.3.332",
144
- "cicy-code-linux-x64": "2.3.331",
145
- "cicy-code-linux-arm64": "2.3.332",
142
+ "cicy-code-darwin-x64": "2.3.343",
143
+ "cicy-code-darwin-arm64": "2.3.343",
144
+ "cicy-code-linux-x64": "2.3.343",
145
+ "cicy-code-linux-arm64": "2.3.343",
146
146
  "cicy-code-windows-x64": "2.3.193",
147
147
  "cicy-mihomo-darwin-x64": "1.10.4",
148
148
  "cicy-mihomo-darwin-arm64": "1.10.4",
@@ -99,6 +99,20 @@ class PanelCells {
99
99
  });
100
100
  const wc = view.webContents;
101
101
  try { view.setBackgroundColor("#ffffff"); } catch (e) {}
102
+ // Chromium uses a dark canvas for transparent/un-styled documents when the
103
+ // app theme is dark (for example a plain `Not Found` response). Keep real
104
+ // site backgrounds intact, but give transparent pages a white fallback.
105
+ wc.on("dom-ready", () => {
106
+ wc.executeJavaScript(`(() => {
107
+ const transparent = (el) => {
108
+ const c = getComputedStyle(el).backgroundColor;
109
+ return c === 'transparent' || /rgba\\([^)]*,\\s*0(?:\\.0+)?\\)$/.test(c);
110
+ };
111
+ if (transparent(document.documentElement) && transparent(document.body)) {
112
+ document.documentElement.style.backgroundColor = '#fff';
113
+ }
114
+ })()`).catch(() => {});
115
+ });
102
116
  try { wc.cicyAccountIdx = profileIdx; } catch (e) {}
103
117
  scrubUA(wc);
104
118
  try { require("../utils/context-menu-options").attachContextMenu(wc); } catch (e) {}
@@ -707,6 +707,19 @@
707
707
  // ("this browser may not be secure")。
708
708
  wv.setAttribute('useragent', navigator.userAgent.replace(/\s(CiCyDesktop|Electron)\/\S+/g, ''));
709
709
  wv.setAttribute('src', url);
710
+ // file:// dev fallback uses a real <webview> instead of PanelCells. Match
711
+ // the native BrowserView behavior for transparent/un-styled pages.
712
+ wv.addEventListener('dom-ready', () => {
713
+ wv.executeJavaScript(`(() => {
714
+ const transparent = (el) => {
715
+ const c = getComputedStyle(el).backgroundColor;
716
+ return c === 'transparent' || /rgba\\([^)]*,\\s*0(?:\\.0+)?\\)$/.test(c);
717
+ };
718
+ if (transparent(document.documentElement) && transparent(document.body)) {
719
+ document.documentElement.style.backgroundColor = '#fff';
720
+ }
721
+ })()`).catch(() => {});
722
+ });
710
723
  wv.addEventListener('did-start-loading', () => c.el.classList.add('loading'));
711
724
  wv.addEventListener('did-stop-loading', () => c.el.classList.remove('loading'));
712
725
  wv.addEventListener('did-navigate', (e) => syncUrl(leafId, e.url));
@@ -36,6 +36,33 @@ const managerByHost = new Map(); // shell webContents.id -> TabManager
36
36
 
37
37
  function stripVol(u) { try { const x = new URL(u); return x.origin + x.pathname; } catch (e) { return u || ""; } }
38
38
 
39
+ const INSTANCE_HOST_RE = /^(team-[a-z0-9][a-z0-9-]{0,30}-[0-9]+-[0-9a-f]{8})\.cicy-ai\.com$/;
40
+
41
+ // Keep the fixed Instance authentication shuttle in the current team tab.
42
+ // This is deliberately narrower than trusting *.cicy-ai.com: only the exact
43
+ // Instance → Cloud connect route and Cloud → same Instance one-time grant route
44
+ // are allowed to cross origins. Every other profile-0 cross-origin navigation
45
+ // still gets moved to the hard-sandboxed browser profile below.
46
+ function isInstanceAuthNavigation(currentUrl, targetUrl) {
47
+ let current; let target;
48
+ try { current = new URL(currentUrl); target = new URL(targetUrl); } catch (e) { return false; }
49
+ if (current.protocol !== "https:" || target.protocol !== "https:") return false;
50
+
51
+ const currentInstance = current.hostname.match(INSTANCE_HOST_RE);
52
+ if (currentInstance && target.hostname === "cicy-ai.com") {
53
+ return target.pathname === "/instance-connect"
54
+ && target.searchParams.get("slug") === currentInstance[1];
55
+ }
56
+
57
+ const targetInstance = target.hostname.match(INSTANCE_HOST_RE);
58
+ if (current.hostname === "cicy-ai.com" && targetInstance) {
59
+ const grant = target.searchParams.get("grant") || "";
60
+ return target.pathname === "/_proxy/login"
61
+ && /^[A-Za-z0-9_-]{40,64}$/.test(grant);
62
+ }
63
+ return false;
64
+ }
65
+
39
66
  // 团队 tab 的 webContentsId 状态表:openTab 时记入、对应 webContents destroy 时删除
40
67
  // (打开/关闭都更新)。刷新窗口据此按 wcId 强制 reload(reloadIgnoringCache),避开
41
68
  // "tab 打开后 URL 漂移(登录跳转 / token / 重定向)→ 按 URL 匹配失败"的 bug。
@@ -383,7 +410,10 @@ class TabManager {
383
410
  let tgt; try { tgt = new URL(u); } catch { return; }
384
411
  if (tgt.protocol === "about:") return;
385
412
  let curOrigin = ""; try { curOrigin = new URL(wc.getURL()).origin; } catch {}
386
- if (tgt.origin !== curOrigin) { e.preventDefault(); openTab(1, u); }
413
+ if (tgt.origin !== curOrigin && !(tab.team && isInstanceAuthNavigation(wc.getURL(), u))) {
414
+ e.preventDefault();
415
+ openTab(1, u);
416
+ }
387
417
  } catch (err) {}
388
418
  });
389
419
  }