cicy-desktop 2.1.32 → 2.1.33
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 +12 -2
- package/package.json +1 -1
package/bin/cicy-desktop
CHANGED
|
@@ -13,6 +13,11 @@ const GLOBAL_CONFIG_FILE = path.join(HOME, "global.json");
|
|
|
13
13
|
const STATE_FILE = path.join(HOME, ".cicy-cluster.json");
|
|
14
14
|
const LOGS_DIR = path.join(HOME, "logs");
|
|
15
15
|
const PACKAGE_ROOT = path.join(__dirname, "..");
|
|
16
|
+
// CN defaults: a fresh machine has no cached electron binary, so npx's electron
|
|
17
|
+
// postinstall would hit GitHub releases and fail (ECOMPROMISED). Mirror it +
|
|
18
|
+
// the npm registry to npmmirror (overridable via the same-named env vars).
|
|
19
|
+
const ELECTRON_MIRROR = process.env.ELECTRON_MIRROR || "https://npmmirror.com/mirrors/electron/";
|
|
20
|
+
const NPM_REGISTRY = process.env.CICY_NPM_REGISTRY || process.env.npm_config_registry || "https://registry.npmmirror.com";
|
|
16
21
|
const MASTER_ENTRY = path.join(PACKAGE_ROOT, "src", "master", "master-main.js");
|
|
17
22
|
|
|
18
23
|
// Resolve the electron binary to spawn. Prefers the project-local copy
|
|
@@ -375,8 +380,13 @@ function ensureMacDesktopApp() {
|
|
|
375
380
|
const nodeDir = nodeBinDir();
|
|
376
381
|
// do shell script needs node on PATH (GUI launch has a minimal PATH); the
|
|
377
382
|
// trailing & + nohup + </dev/null lets the shell return so the applet quits.
|
|
383
|
+
// ELECTRON_MIRROR + npmmirror: a fresh CN machine has no cached electron
|
|
384
|
+
// binary, so npx's electron postinstall would try GitHub releases and fail
|
|
385
|
+
// (ECOMPROMISED / lock-compromised). Point it at npmmirror's electron mirror.
|
|
386
|
+
// Harmless elsewhere — only consulted when electron actually (re)downloads.
|
|
378
387
|
const ascript =
|
|
379
388
|
`do shell script "export PATH=\\"${nodeDir}:/usr/local/bin:/opt/homebrew/bin:$PATH\\" ; ` +
|
|
389
|
+
`export ELECTRON_MIRROR=\\"${ELECTRON_MIRROR}\\" ; export npm_config_registry=\\"${NPM_REGISTRY}\\" ; ` +
|
|
380
390
|
`nohup npx -y cicy-desktop > /tmp/cicy-desktop.log 2>&1 < /dev/null &"`;
|
|
381
391
|
const tmp = path.join(os.tmpdir(), `cicy-launch-${process.pid}.applescript`);
|
|
382
392
|
fs.writeFileSync(tmp, ascript);
|
|
@@ -402,7 +412,7 @@ function ensureLinuxDesktopEntry() {
|
|
|
402
412
|
`[Desktop Entry]
|
|
403
413
|
Type=Application
|
|
404
414
|
Name=CiCy Desktop
|
|
405
|
-
Exec=sh -c 'export PATH="${nodeBinDir()}:$PATH"; exec npx -y cicy-desktop'
|
|
415
|
+
Exec=sh -c 'export PATH="${nodeBinDir()}:$PATH"; export ELECTRON_MIRROR="${ELECTRON_MIRROR}"; export npm_config_registry="${NPM_REGISTRY}"; exec npx -y cicy-desktop'
|
|
406
416
|
Icon=${icon}
|
|
407
417
|
Terminal=false
|
|
408
418
|
Categories=Development;
|
|
@@ -422,7 +432,7 @@ function ensureWindowsShortcut() {
|
|
|
422
432
|
`$ws = New-Object -ComObject WScript.Shell
|
|
423
433
|
$s = $ws.CreateShortcut('${lnk.replace(/'/g, "''")}')
|
|
424
434
|
$s.TargetPath = 'cmd.exe'
|
|
425
|
-
$s.Arguments = '/c set PATH=${nodeDir};%PATH
|
|
435
|
+
$s.Arguments = '/c set PATH=${nodeDir};%PATH%&& set ELECTRON_MIRROR=${ELECTRON_MIRROR}&& set npm_config_registry=${NPM_REGISTRY}&& npx -y cicy-desktop'
|
|
426
436
|
$s.IconLocation = '${ico.replace(/'/g, "''")}'
|
|
427
437
|
$s.Save()
|
|
428
438
|
`);
|