cicy-desktop 2.1.357 → 2.1.358
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 +1 -1
- package/src/app-updater.js +24 -0
- package/src/tabbrowser/panel-cells.js +5 -0
package/package.json
CHANGED
package/src/app-updater.js
CHANGED
|
@@ -291,6 +291,26 @@ function broadcast(patch) {
|
|
|
291
291
|
}
|
|
292
292
|
function getState() { return _state; }
|
|
293
293
|
|
|
294
|
+
function cmpVer(a, b) {
|
|
295
|
+
const x = String(a).split(".").map(Number), y = String(b).split(".").map(Number);
|
|
296
|
+
for (let i = 0; i < 3; i++) { if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) - (y[i] || 0); }
|
|
297
|
+
return 0;
|
|
298
|
+
}
|
|
299
|
+
// 只认更新器自己命名的 cicy-desktop-<x.y.z>.exe / .dmg / .AppImage,别的文件一律不碰;
|
|
300
|
+
// 版本 >= 当前的保留(可能正在下载或刚装完还没重启)。
|
|
301
|
+
function cleanupOldInstallers() {
|
|
302
|
+
const cur = app.getVersion();
|
|
303
|
+
let dir = ""; try { dir = app.getPath("downloads"); } catch { return; }
|
|
304
|
+
let names = []; try { names = fs.readdirSync(dir); } catch { return; }
|
|
305
|
+
let n = 0;
|
|
306
|
+
for (const f of names) {
|
|
307
|
+
const m = f.match(/^cicy-desktop-(\d+\.\d+\.\d+)\.(exe|dmg|AppImage)$/i);
|
|
308
|
+
if (!m || cmpVer(m[1], cur) >= 0) continue;
|
|
309
|
+
try { fs.unlinkSync(path.join(dir, f)); n++; } catch {}
|
|
310
|
+
}
|
|
311
|
+
if (n) log.info(`[app-updater] removed ${n} old installer(s) from ${dir}`);
|
|
312
|
+
}
|
|
313
|
+
|
|
294
314
|
function init(mainWin) {
|
|
295
315
|
_win = mainWin;
|
|
296
316
|
_state.current = app.getVersion();
|
|
@@ -298,6 +318,10 @@ function init(mainWin) {
|
|
|
298
318
|
// Running the version we last tried to install = that attempt worked; forget
|
|
299
319
|
// it so a future update to the same number is never wrongly blocked.
|
|
300
320
|
try { if (readAutoTry().version === _state.current) clearAutoTry(); } catch {}
|
|
321
|
+
// 清掉 Downloads 里旧版本的安装包。每次自动更新都往 Downloads 下一个 125MB 的
|
|
322
|
+
// cicy-desktop-<ver>.exe,装完从不删:实测 2026-09-12 全队 18 台堆了 56.8GB,
|
|
323
|
+
// xs-3008 的 C 盘直接写满,新版下到 92% 报 ENOSPC 装不上。只删比当前运行版本低的。
|
|
324
|
+
setTimeout(() => { try { cleanupOldInstallers(); } catch {} }, 5_000);
|
|
301
325
|
setTimeout(() => check().catch(() => {}), 15_000); // 启动后探一次
|
|
302
326
|
setInterval(() => check().catch(() => {}), 30 * 60 * 1000); // 每 30 分钟
|
|
303
327
|
}
|
|
@@ -134,6 +134,11 @@ class PanelCells {
|
|
|
134
134
|
},
|
|
135
135
|
});
|
|
136
136
|
const wc = view.webContents;
|
|
137
|
+
// 格子不在当前 tab / 被弹窗盖住时是 visible:false(不贴到窗口上),Electron 对隐藏
|
|
138
|
+
// 视图默认开后台节流,定时器被拖到 1Hz,Telegram Web 的心跳超时后就一直
|
|
139
|
+
// 「Reconnecting...」(实测 2026-09-12,xs-3004 面板切到后台后三格全部掉线)。
|
|
140
|
+
// 保活的前提就是隐藏着也得活着,所以关掉节流。
|
|
141
|
+
try { view.webContents.setBackgroundThrottling(false); } catch (e) {}
|
|
137
142
|
const rec = { view, url: "", profile: profileIdx, visible: true, identity: null };
|
|
138
143
|
try { view.setBackgroundColor("#ffffff"); } catch (e) {}
|
|
139
144
|
// Chromium uses a dark canvas for transparent/un-styled documents when the
|