cicy-desktop 2.1.230 → 2.1.232

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.230",
3
+ "version": "2.1.232",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -87,17 +87,20 @@ function headOk(url, redirects = 0) {
87
87
 
88
88
  // ── 最新版本号 ────────────────────────────────────────────────────────────────
89
89
  async function fetchLatestVersion(network) {
90
- if (network === "cn") {
91
- // CN:OSS 版本清单(纯文本 "2.1.200")。**按平台读各自的指针** —— win 和 mac 是两条独立
92
- // CI、分别构建上传、版本可能不同步;都读裸名 latest-version.txt(只由 Windows CI 写)会让
93
- // mac 客户端拿到 Windows 的版本号 → 去下不存在的 mac 包 → 404。win→win-、mac→mac-,
94
- // linux 没有独立 OSS 指针、沿用裸名(win 同 tag 同步发布,且 linux 实际走 GitHub 下载)
95
- const file = process.platform === "win32" ? "win-latest-version.txt"
96
- : process.platform === "darwin" ? "mac-latest-version.txt"
97
- : "latest-version.txt";
90
+ // **Windows 包只在 OSS(GitHub 不发 win),版本清单也一律读 OSS —— 与网络判定无关。**
91
+ // 否则 net=unknown(启动探测超时会被缓存成 unknown 整个会话) global 时去读 GitHub,CN
92
+ // 用户读不到 → 更新提示整段会话都不出现(用户报的「更新 banner 没出现」)。win→win-latest。
93
+ if (process.platform === "win32") {
94
+ return (await getText(`${OSS_RELEASES_BASE}/win-latest-version.txt`)).trim().replace(/^v/, "");
95
+ }
96
+ // mac/linux:net-detect 契约是「cn unknown 都优先镜像」—— 只有确认可达 GitHub(global)
97
+ // 才走 GitHub;cn/unknown 一律读 OSS。按平台读各自指针(win/mac 两条独立 CI、版本可能不
98
+ // 同步,读错平台会 404);linux 无独立 OSS 指针、沿用裸名(与 win 同 tag、走 GitHub 下载)。
99
+ if (network !== "global") {
100
+ const file = process.platform === "darwin" ? "mac-latest-version.txt" : "latest-version.txt";
98
101
  return (await getText(`${OSS_RELEASES_BASE}/${file}`)).trim().replace(/^v/, "");
99
102
  }
100
- // CN:GitHub releases/latest 的 tag_name。
103
+ // 确认可达 GitHub:releases/latest 的 tag_name。
101
104
  const j = JSON.parse(await getText(`https://api.github.com/repos/${REPO}/releases/latest`));
102
105
  return String(j.tag_name || "").trim().replace(/^v/, "");
103
106
  }
@@ -112,11 +115,11 @@ function assetFor(version, network) {
112
115
  }
113
116
  if (plat === "darwin") {
114
117
  const gh = `${GH_DL(version)}/cicy-desktop-${version}-${arch}.pkg`;
115
- return { url: network === "cn" ? mirrored(gh) : gh, file: `cicy-desktop-${version}-${arch}.pkg` };
118
+ return { url: network === "global" ? gh : mirrored(gh), file: `cicy-desktop-${version}-${arch}.pkg` };
116
119
  }
117
120
  // linux
118
121
  const gh = `${GH_DL(version)}/CiCy-Desktop-${version}.AppImage`;
119
- return { url: network === "cn" ? mirrored(gh) : gh, file: `CiCy-Desktop-${version}.AppImage` };
122
+ return { url: network === "global" ? gh : mirrored(gh), file: `CiCy-Desktop-${version}.AppImage` };
120
123
  }
121
124
 
122
125
  // ── 下载(带进度,跟随重定向)──────────────────────────────────────────────────
@@ -28,10 +28,12 @@ let homeTabWc = null; // the homepage's resident-tab webContents (primary path
28
28
  // browser window (homepage = profile 0 的起始页). Clicking a team there
29
29
  // opens the team as another tab in the same window. Falls back to a standalone
30
30
  // window only if the tab engine throws, so the homepage is never unreachable.
31
- async function openHomepage() {
31
+ async function openHomepage(opts = {}) {
32
32
  try {
33
33
  const tabBrowser = require("../tools/tab-browser-tools");
34
- const { win, wc } = tabBrowser.openHomeWindow(0, pickHomepageURL());
34
+ // opts.activate=false(deeplink / second-instance 顺带调用)→ 不抢用户当前 tab,只保证
35
+ // 首页存在 + 窗口在前台;不传(tray「打开首页」/ 启动)→ 默认切到首页 tab。
36
+ const { win, wc } = tabBrowser.openHomeWindow(0, pickHomepageURL(), opts);
35
37
  if (wc) {
36
38
  homeTabWc = wc;
37
39
  try { wc.once("destroyed", () => { if (homeTabWc === wc) homeTabWc = null; }); } catch {}
package/src/main.js CHANGED
@@ -248,7 +248,7 @@ async function handleDeepLink(url) {
248
248
  if (electronApp.isReady()) {
249
249
  try {
250
250
  const { openHomepage } = require("./backends/homepage-window");
251
- openHomepage();
251
+ openHomepage({ activate: false }); // deeplink 顺带唤起,不抢用户当前 tab(团队列表已由 broadcast 刷新)
252
252
  } catch {}
253
253
  }
254
254
  }
@@ -276,7 +276,7 @@ electronApp.on("second-instance", (_e, argv) => {
276
276
 
277
277
  try {
278
278
  const { openHomepage } = require("./backends/homepage-window");
279
- openHomepage();
279
+ openHomepage({ activate: false }); // 再次启动 exe 只把窗口带到前台,不抢走用户正在看的团队 tab
280
280
  } catch {}
281
281
  const { BrowserWindow } = require("electron");
282
282
  for (const w of BrowserWindow.getAllWindows()) {
@@ -389,11 +389,18 @@ async function openTab(accountIdx, url, opts = {}) {
389
389
  // { win, wc } so the homepage module can track the tab's webContents for the
390
390
  // main→renderer pushes (auth:complete, update-state) that used to target the
391
391
  // standalone homepage window.
392
- function openHomeWindow(accountIdx, homeUrl) {
392
+ function openHomeWindow(accountIdx, homeUrl, opts = {}) {
393
393
  const m = ensureManager(accountIdx);
394
394
  let tab = m.tabs.find((t) => t.home);
395
- if (tab) { m.activate(tab.id); }
396
- else { const id = m.addTab(homeUrl, { home: true }); tab = m.tabs.find((t) => t.id === id); }
395
+ if (tab) {
396
+ // 只在明确要求(用户点「打开首页」/ 启动)时才切到首页 tab。deeplink / second-instance
397
+ // **顺带**触发 openHomepage 的路径传 activate:false —— 绝不抢走用户正在看的团队 tab,否则
398
+ // 对话着对话着窗口就莫名切到「我的团队」(用户报的 bug)。当前本来就是首页 tab、或还没有任何
399
+ // active tab 时,activate 无副作用,照常执行。
400
+ if (opts.activate !== false || m.activeId == null || m.activeId === tab.id) m.activate(tab.id);
401
+ } else {
402
+ const id = m.addTab(homeUrl, { home: true }); tab = m.tabs.find((t) => t.id === id);
403
+ }
397
404
  try { m.win.show(); m.win.focus(); } catch (e) {}
398
405
  let wc = null; try { wc = tab ? tab.view.webContents : null; } catch (e) {}
399
406
  return { win: m.win, wc };