dsh-oc-desktop 0.3.10 → 0.3.11

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.
@@ -73,7 +73,10 @@ function ensureElectron(electron) {
73
73
  process.exit(1);
74
74
  }
75
75
  try {
76
- execFileSync(process.execPath, [installJs], { stdio: 'inherit', windowsHide: true });
76
+ // Default to the npmmirror mirror unless the user set ELECTRON_MIRROR already.
77
+ const env = Object.assign({}, process.env);
78
+ if (!env.ELECTRON_MIRROR) env.ELECTRON_MIRROR = 'https://npmmirror.com/mirrors/electron/';
79
+ execFileSync(process.execPath, [installJs], { stdio: 'inherit', windowsHide: true, env });
77
80
  } catch (e) {
78
81
  console.error(`dsh-oc-desktop: failed to fetch electron binary: ${e && e.message ? e.message : e}`);
79
82
  console.error('If this is a network issue, set ELECTRON_MIRROR to a mirror and retry.');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-oc-desktop",
3
3
  "productName": "DeepSeek Harness Desktop",
4
- "version": "0.3.10",
4
+ "version": "0.3.11",
5
5
  "description": "DeepSeek Harness 桌面端插件(Electron 启动器):自绘标题栏/托盘/通知/快捷键/崩溃自愈",
6
6
  "main": "launcher/main.js",
7
7
  "bin": {
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "scripts": {
11
11
  "start": "electron .",
12
- "test": "node --check launcher/main.js && node --check launcher/preload.js && node --check launcher/dialog-preload.js && node --check launcher/events.js && node --check launcher/session-window.js && node --check launcher/updater.js && node --check launcher/apply-update.js && node --check bin/dsh-desktop.cjs && node scripts/test.mjs && node scripts/test-updater.mjs"
12
+ "postinstall": "node scripts/postinstall.js",
13
+ "test": "node --check launcher/main.js && node --check launcher/preload.js && node --check launcher/dialog-preload.js && node --check launcher/events.js && node --check launcher/session-window.js && node --check launcher/updater.js && node --check launcher/apply-update.js && node --check bin/dsh-desktop.cjs && node --check scripts/postinstall.js && node scripts/test.mjs && node scripts/test-updater.mjs"
13
14
  },
14
15
  "dependencies": {
15
16
  "electron": "^43.4.0"
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // dsh-oc-desktop postinstall: make sure the electron binary exists after install.
4
+ // npm package-cache hits can skip electron's postinstall (dist/ left empty), which
5
+ // makes the desktop shell unbootable. Download it now via the npmmirror mirror so
6
+ // the install is complete; never fail the install — the bin self-heals on first
7
+ // launch as a last resort.
8
+ const fs = require('node:fs');
9
+ const path = require('node:path');
10
+ const { spawnSync } = require('node:child_process');
11
+
12
+ const ELECTRON_MIRROR_DEFAULT = 'https://npmmirror.com/mirrors/electron/';
13
+
14
+ const electronDir = path.join(__dirname, '..', 'node_modules', 'electron');
15
+ if (!fs.existsSync(path.join(electronDir, 'install.js'))) process.exit(0);
16
+ const exe = path.join(electronDir, 'dist', process.platform === 'win32' ? 'electron.exe' : 'electron');
17
+ if (fs.existsSync(exe)) process.exit(0);
18
+
19
+ console.log('dsh-oc-desktop: electron binary missing, downloading (mirror) ...');
20
+ const env = Object.assign({}, process.env);
21
+ if (!env.ELECTRON_MIRROR) env.ELECTRON_MIRROR = ELECTRON_MIRROR_DEFAULT;
22
+ const r = spawnSync(process.execPath, [path.join(electronDir, 'install.js')], { stdio: 'inherit', env, windowsHide: true });
23
+ if (r.status !== 0 || !fs.existsSync(exe)) {
24
+ console.warn('dsh-oc-desktop: electron binary fetch failed; it will self-heal on first launch.');
25
+ }
26
+ process.exit(0);