cicy-desktop 2.1.56 → 2.1.57
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 +3 -2
- package/src/main.js +20 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cicy-desktop",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.57",
|
|
4
4
|
"description": "CiCy - AI-powered operating system browser",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -26,8 +26,9 @@
|
|
|
26
26
|
"productName": "CiCy Desktop",
|
|
27
27
|
"protocols": [
|
|
28
28
|
{
|
|
29
|
-
"name": "CiCy URL",
|
|
29
|
+
"name": "CiCy Desktop URL",
|
|
30
30
|
"schemes": [
|
|
31
|
+
"cicy-desktop",
|
|
31
32
|
"cicy"
|
|
32
33
|
]
|
|
33
34
|
}
|
package/src/main.js
CHANGED
|
@@ -117,12 +117,20 @@ if (!__singleLock) {
|
|
|
117
117
|
electronApp.exit(0);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
// Register cicy:// as
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
// Register cicy-desktop:// as the desktop's URL protocol. We MOVED off the bare
|
|
121
|
+
// `cicy://` scheme because it collides: the CiCy mobile/Expo app (com.cicy-ai
|
|
122
|
+
// .mobile) and a generic com.github.Electron both claim `cicy:`, so a browser
|
|
123
|
+
// click routes the deeplink to the wrong app (the desktop only got it when an
|
|
124
|
+
// already-running Electron instance happened to intercept its own scheme).
|
|
125
|
+
// `cicy-desktop://` is desktop-only → browsers route it unambiguously here.
|
|
126
|
+
// `cicy://` stays registered + accepted for back-compat with old links.
|
|
127
|
+
// On macOS the OS calls open-url; on Windows/Linux the URL arrives in argv
|
|
128
|
+
// (second-instance below, or process.argv on cold start).
|
|
129
|
+
const DEEPLINK_SCHEMES = ["cicy-desktop", "cicy"]; // primary, then legacy
|
|
130
|
+
const isDeepLink = (u) =>
|
|
131
|
+
typeof u === "string" && DEEPLINK_SCHEMES.some((s) => u.startsWith(`${s}://`));
|
|
132
|
+
for (const s of DEEPLINK_SCHEMES) {
|
|
133
|
+
try { if (!electronApp.isDefaultProtocolClient(s)) electronApp.setAsDefaultProtocolClient(s); } catch {}
|
|
126
134
|
}
|
|
127
135
|
|
|
128
136
|
// Deep links can arrive before any BrowserWindow exists (cold start via
|
|
@@ -165,9 +173,10 @@ electronApp.on("browser-window-created", (_e, win) => {
|
|
|
165
173
|
|
|
166
174
|
async function handleDeepLink(url) {
|
|
167
175
|
log.info(`[deeplink] handleDeepLink got: ${url}`);
|
|
168
|
-
if (!url
|
|
176
|
+
if (!isDeepLink(url)) return;
|
|
169
177
|
try {
|
|
170
|
-
// cicy://addTeam?title=My+Team&url=https://...&token=xxx
|
|
178
|
+
// cicy-desktop://addTeam?title=My+Team&url=https://...&token=xxx
|
|
179
|
+
// (legacy cicy://addTeam?... still accepted)
|
|
171
180
|
const u = new URL(url);
|
|
172
181
|
const action = (u.hostname || "").toLowerCase();
|
|
173
182
|
if (action === "addteam") {
|
|
@@ -219,13 +228,13 @@ electronApp.on("open-url", (_e, url) => {
|
|
|
219
228
|
// Cold start on Windows/Linux: protocol URL is the last argv element. macOS
|
|
220
229
|
// also gets the argv copy on some launchers, so this is harmless there.
|
|
221
230
|
{
|
|
222
|
-
const coldUrl = process.argv.find(a =>
|
|
231
|
+
const coldUrl = process.argv.find(a => isDeepLink(a));
|
|
223
232
|
if (coldUrl) handleDeepLink(coldUrl);
|
|
224
233
|
}
|
|
225
234
|
|
|
226
235
|
electronApp.on("second-instance", (_e, argv) => {
|
|
227
|
-
// argv may include cicy:// URL on Windows/Linux
|
|
228
|
-
const cicyUrl = argv.find(a => a
|
|
236
|
+
// argv may include a cicy-desktop:// (or legacy cicy://) URL on Windows/Linux
|
|
237
|
+
const cicyUrl = argv.find(a => isDeepLink(a));
|
|
229
238
|
if (cicyUrl) handleDeepLink(cicyUrl);
|
|
230
239
|
|
|
231
240
|
try {
|