cicy-desktop 2.1.37 → 2.1.39
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/bin/cicy-desktop +8 -0
- package/package.json +1 -1
- package/src/main.js +20 -1
package/bin/cicy-desktop
CHANGED
|
@@ -377,6 +377,12 @@ function ensureMacDesktopApp() {
|
|
|
377
377
|
// via `do shell script`, then quits. Icon = the applet's applet.icns.
|
|
378
378
|
const { execFileSync } = require("child_process");
|
|
379
379
|
const appDir = path.join(DESKTOP_DIR, "CiCy Desktop.app");
|
|
380
|
+
// Idempotent — create only when missing. When the app is launched FROM this
|
|
381
|
+
// very applet (double-click), the old code's fs.rmSync(appDir) tries to
|
|
382
|
+
// delete the running bundle: the rmdir syscall blocks FOREVER (the app
|
|
383
|
+
// deleting itself), so startup hangs at "Cleaning up ports" and no window
|
|
384
|
+
// ever appears ("打不开"). Skip if it already exists.
|
|
385
|
+
if (fs.existsSync(appDir)) return;
|
|
380
386
|
const nodeDir = nodeBinDir();
|
|
381
387
|
// do shell script needs node on PATH (GUI launch has a minimal PATH); the
|
|
382
388
|
// trailing & + nohup + </dev/null lets the shell return so the applet quits.
|
|
@@ -407,6 +413,7 @@ function ensureMacDesktopApp() {
|
|
|
407
413
|
function ensureLinuxDesktopEntry() {
|
|
408
414
|
const icon = path.join(PACKAGE_ROOT, "build", "icons", "icon-256.png");
|
|
409
415
|
const file = path.join(DESKTOP_DIR, "cicy-desktop.desktop");
|
|
416
|
+
if (fs.existsSync(file)) return; // idempotent: create only when missing
|
|
410
417
|
fs.mkdirSync(DESKTOP_DIR, { recursive: true });
|
|
411
418
|
fs.writeFileSync(file,
|
|
412
419
|
`[Desktop Entry]
|
|
@@ -433,6 +440,7 @@ function ensureWindowsShortcut() {
|
|
|
433
440
|
// launches via the global bin (see README "Run via npx" / install one-liner).
|
|
434
441
|
const ico = path.join(PACKAGE_ROOT, "build", "icon.ico");
|
|
435
442
|
const lnk = path.join(DESKTOP_DIR, "CiCy Desktop.lnk");
|
|
443
|
+
if (fs.existsSync(lnk)) return; // idempotent: create only when missing (also avoids re-popping 360 each launch)
|
|
436
444
|
const nodeDir = nodeBinDir();
|
|
437
445
|
const ps = path.join(require("os").tmpdir(), `cicy-shortcut-${process.pid}.ps1`);
|
|
438
446
|
fs.writeFileSync(ps,
|
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -163,7 +163,7 @@ electronApp.on("browser-window-created", (_e, win) => {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
function handleDeepLink(url) {
|
|
166
|
+
async function handleDeepLink(url) {
|
|
167
167
|
log.info(`[deeplink] handleDeepLink got: ${url}`);
|
|
168
168
|
if (!url || !url.startsWith("cicy://")) return;
|
|
169
169
|
try {
|
|
@@ -176,6 +176,25 @@ function handleDeepLink(url) {
|
|
|
176
176
|
url: u.searchParams.get("url") || "",
|
|
177
177
|
token: u.searchParams.get("token") || "",
|
|
178
178
|
};
|
|
179
|
+
// Add the team HERE in the main process — robust and independent of
|
|
180
|
+
// whether a renderer is loaded/listening. (The renderer never wired up
|
|
181
|
+
// window.cicy.deeplink.onAddTeam, so the old broadcast-only path silently
|
|
182
|
+
// dropped the team.) local-teams.addTeam upserts by base_url; the
|
|
183
|
+
// homepage polls localTeams:list every few seconds so the new team shows
|
|
184
|
+
// up on its own. We still broadcast for an instant refresh.
|
|
185
|
+
if (payload.url) {
|
|
186
|
+
try {
|
|
187
|
+
const lt = require("./backends/local-teams");
|
|
188
|
+
const r = await lt.addTeam({
|
|
189
|
+
base_url: payload.url,
|
|
190
|
+
api_token: payload.token || undefined,
|
|
191
|
+
name: payload.title || undefined,
|
|
192
|
+
});
|
|
193
|
+
log.info(`[deeplink] addTeam result: ${JSON.stringify(r)}`);
|
|
194
|
+
} catch (e) {
|
|
195
|
+
log.warn(`[deeplink] addTeam failed: ${e.message}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
179
198
|
broadcastDeepLink("deeplink:addTeam", payload);
|
|
180
199
|
// Make sure SOMETHING is on screen for the user to see the result.
|
|
181
200
|
// Safe to call before whenReady — openHomepage waits for the app
|