cicy-desktop 2.1.259 → 2.1.260
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 +5 -5
- package/src/main.js +0 -6
- package/src/tray.js +130 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cicy-desktop",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.260",
|
|
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.
|
|
143
|
-
"cicy-code-darwin-arm64": "2.3.
|
|
144
|
-
"cicy-code-linux-x64": "2.3.
|
|
145
|
-
"cicy-code-linux-arm64": "2.3.
|
|
142
|
+
"cicy-code-darwin-x64": "2.3.316",
|
|
143
|
+
"cicy-code-darwin-arm64": "2.3.316",
|
|
144
|
+
"cicy-code-linux-x64": "2.3.316",
|
|
145
|
+
"cicy-code-linux-arm64": "2.3.316",
|
|
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",
|
package/src/main.js
CHANGED
|
@@ -1470,12 +1470,6 @@ electronApp.whenReady().then(async () => {
|
|
|
1470
1470
|
: [{ label: i18n.t("menu.close"), role: "close" }]),
|
|
1471
1471
|
],
|
|
1472
1472
|
},
|
|
1473
|
-
...(process.platform !== "darwin" ? [{
|
|
1474
|
-
label: i18n.t("menu.help"),
|
|
1475
|
-
submenu: [
|
|
1476
|
-
{ label: "打开 cicy-ai.com", click: openCicyAi },
|
|
1477
|
-
],
|
|
1478
|
-
}] : []),
|
|
1479
1473
|
];
|
|
1480
1474
|
Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));
|
|
1481
1475
|
};
|
package/src/tray.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// so they're available at runtime in both dev (./build/...) and packaged
|
|
8
8
|
// (process.resourcesPath/build/...) modes.
|
|
9
9
|
|
|
10
|
-
const { app, Tray, Menu, nativeImage,
|
|
10
|
+
const { app, Tray, Menu, nativeImage, dialog } = require("electron");
|
|
11
11
|
const path = require("path");
|
|
12
12
|
const fs = require("fs");
|
|
13
13
|
const log = require("electron-log");
|
|
@@ -42,6 +42,134 @@ function setupDockIcon() {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
async function openCicyAiInProfile1() {
|
|
46
|
+
try {
|
|
47
|
+
const tabs = require("./tools/tab-browser-tools");
|
|
48
|
+
await tabs.openTab(1, "https://cicy-ai.com", { activate: true });
|
|
49
|
+
const manager = tabs.ensureManager(1);
|
|
50
|
+
if (manager.win.isMinimized()) manager.win.restore();
|
|
51
|
+
manager.win.show();
|
|
52
|
+
manager.win.focus();
|
|
53
|
+
} catch (e) {
|
|
54
|
+
log.warn(`[Tray] open cicy-ai.com in Electron Profile 1 failed: ${e.message}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function openElectronProfile(accountIdx) {
|
|
59
|
+
try {
|
|
60
|
+
const tabs = require("./tools/tab-browser-tools");
|
|
61
|
+
await tabs.openTab(accountIdx, undefined, { activate: true });
|
|
62
|
+
const manager = tabs.ensureManager(accountIdx);
|
|
63
|
+
if (manager.win.isMinimized()) manager.win.restore();
|
|
64
|
+
manager.win.show();
|
|
65
|
+
manager.win.focus();
|
|
66
|
+
} catch (e) {
|
|
67
|
+
showProfileError("Electron", e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function openChromeProfile(accountIdx) {
|
|
72
|
+
try {
|
|
73
|
+
await require("./tools/chrome-tools").launchOrActivateProfile({
|
|
74
|
+
accountIdx,
|
|
75
|
+
activateIfRunning: true,
|
|
76
|
+
});
|
|
77
|
+
} catch (e) {
|
|
78
|
+
showProfileError("Chrome", e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function showProfileError(kind, error) {
|
|
83
|
+
dialog.showMessageBox({
|
|
84
|
+
type: "error",
|
|
85
|
+
message: `${kind} Profile 操作失败`,
|
|
86
|
+
detail: String((error && error.message) || error),
|
|
87
|
+
buttons: ["OK"],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function listProfiles(backend) {
|
|
92
|
+
try {
|
|
93
|
+
let rows = require("./profiles/profile-store").listProfiles(backend);
|
|
94
|
+
if (backend === "electron") {
|
|
95
|
+
rows = rows.filter((p) => ![0, 9].includes(Number(p.accountIdx)));
|
|
96
|
+
}
|
|
97
|
+
return rows;
|
|
98
|
+
} catch (_) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function addProfileFromTray(kind) {
|
|
104
|
+
try {
|
|
105
|
+
const { executeTool } = require("./server/tool-executor");
|
|
106
|
+
const result = await executeTool(kind === "Electron" ? "electron_add_profile" : "chrome_add_profile", {});
|
|
107
|
+
const text = result && result.content && result.content[0] && result.content[0].text;
|
|
108
|
+
let data = {};
|
|
109
|
+
try { data = JSON.parse(text || "{}"); } catch {}
|
|
110
|
+
if (result && result.isError) throw new Error(data.error || text || "unknown error");
|
|
111
|
+
const accountIdx = Number(data.accountIdx ?? (data.created && data.created.accountIdx));
|
|
112
|
+
installTrayMenu();
|
|
113
|
+
if (Number.isFinite(accountIdx)) {
|
|
114
|
+
if (kind === "Electron") await openElectronProfile(accountIdx);
|
|
115
|
+
else await openChromeProfile(accountIdx);
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
showProfileError(kind, e);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function installTrayMenu() {
|
|
123
|
+
if (!trayInstance) return;
|
|
124
|
+
const electronRows = listProfiles("electron");
|
|
125
|
+
const chromeRows = listProfiles("chrome");
|
|
126
|
+
const template = [
|
|
127
|
+
{
|
|
128
|
+
label: i18n.t("tray.openHomepage"),
|
|
129
|
+
click: () => openHomepage(),
|
|
130
|
+
},
|
|
131
|
+
...(process.platform === "win32" ? [
|
|
132
|
+
{
|
|
133
|
+
label: "打开 cicy-ai.com",
|
|
134
|
+
click: () => openCicyAiInProfile1(),
|
|
135
|
+
},
|
|
136
|
+
{ type: "separator" },
|
|
137
|
+
{
|
|
138
|
+
label: "Electron",
|
|
139
|
+
submenu: [
|
|
140
|
+
{ label: "新增 Profile", click: () => addProfileFromTray("Electron") },
|
|
141
|
+
...(electronRows.length ? [{ type: "separator" }] : []),
|
|
142
|
+
...electronRows.map((p) => ({
|
|
143
|
+
label: `Profile ${p.accountIdx}${p.name ? ` · ${p.name}` : ""}`,
|
|
144
|
+
click: () => openElectronProfile(Number(p.accountIdx)),
|
|
145
|
+
})),
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
label: "Chrome",
|
|
150
|
+
submenu: [
|
|
151
|
+
{ label: "新增 Profile", click: () => addProfileFromTray("Chrome") },
|
|
152
|
+
{ label: "原生 Chrome", click: () => {
|
|
153
|
+
try { require("./tools/chrome-tools").launchNativeChrome(); }
|
|
154
|
+
catch (e) { showProfileError("Chrome", e); }
|
|
155
|
+
} },
|
|
156
|
+
...(chromeRows.length ? [{ type: "separator" }] : []),
|
|
157
|
+
...chromeRows.map((p) => ({
|
|
158
|
+
label: `Profile ${p.accountIdx}${p.gmail ? ` · ${p.gmail}` : p.note ? ` · ${p.note}` : ""}`,
|
|
159
|
+
click: () => openChromeProfile(Number(p.accountIdx)),
|
|
160
|
+
})),
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
] : []),
|
|
164
|
+
{ type: "separator" },
|
|
165
|
+
{
|
|
166
|
+
label: i18n.t("tray.quit"),
|
|
167
|
+
click: () => app.quit(),
|
|
168
|
+
},
|
|
169
|
+
];
|
|
170
|
+
trayInstance.setContextMenu(Menu.buildFromTemplate(template));
|
|
171
|
+
}
|
|
172
|
+
|
|
45
173
|
function setupTray() {
|
|
46
174
|
try {
|
|
47
175
|
let iconPath;
|
|
@@ -65,19 +193,7 @@ function setupTray() {
|
|
|
65
193
|
|
|
66
194
|
trayInstance = new Tray(img);
|
|
67
195
|
trayInstance.setToolTip(i18n.t("tray.tooltip"));
|
|
68
|
-
|
|
69
|
-
const menu = Menu.buildFromTemplate([
|
|
70
|
-
{
|
|
71
|
-
label: i18n.t("tray.openHomepage"),
|
|
72
|
-
click: () => openHomepage(),
|
|
73
|
-
},
|
|
74
|
-
{ type: "separator" },
|
|
75
|
-
{
|
|
76
|
-
label: i18n.t("tray.quit"),
|
|
77
|
-
click: () => app.quit(),
|
|
78
|
-
},
|
|
79
|
-
]);
|
|
80
|
-
trayInstance.setContextMenu(menu);
|
|
196
|
+
installTrayMenu();
|
|
81
197
|
|
|
82
198
|
// Click on tray icon: open homepage on macOS, toggle on others
|
|
83
199
|
trayInstance.on("click", () => openHomepage());
|