@livedesk/client 0.1.139 → 0.1.140

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.
@@ -4,7 +4,7 @@ import net from 'net';
4
4
  import os from 'os';
5
5
  import path from 'path';
6
6
  import crypto from 'crypto';
7
- import { promises as fs, statfsSync } from 'fs';
7
+ import { existsSync, promises as fs, statfsSync } from 'fs';
8
8
  import { spawn } from 'child_process';
9
9
  import { createRequire } from 'node:module';
10
10
 
@@ -1318,7 +1318,14 @@ function scheduleClientUpdate(options, payload = {}) {
1318
1318
  if (!Number.isInteger(parentPid) || parentPid <= 1) {
1319
1319
  return Promise.reject(new Error('LiveDesk client launcher process id is unavailable.'));
1320
1320
  }
1321
- const command = process.platform === 'win32' ? 'npx.cmd' : 'npx';
1321
+ const nodeBinDir = path.dirname(process.execPath);
1322
+ const npxCandidates = process.platform === 'win32'
1323
+ ? [process.env.LIVEDESK_NPX_EXECUTABLE, path.join(nodeBinDir, 'npx.cmd'), path.join(nodeBinDir, 'npx.exe'), 'npx.cmd']
1324
+ : [process.env.LIVEDESK_NPX_EXECUTABLE, path.join(nodeBinDir, 'npx'), 'npx'];
1325
+ const command = npxCandidates.find(candidate => candidate && (!path.isAbsolute(candidate) || existsSync(candidate)));
1326
+ if (!command) {
1327
+ return Promise.reject(new Error('LiveDesk npx executable was not found.'));
1328
+ }
1322
1329
  return new Promise((resolve, reject) => {
1323
1330
  const child = spawn(command, [
1324
1331
  '-y',
@@ -2526,6 +2526,18 @@ function resolveBundledFfmpegPaths() {
2526
2526
  function buildClientAgentEnvironment(prepared) {
2527
2527
  const env = { ...process.env };
2528
2528
  env.LIVEDESK_CLIENT_PARENT_PID = String(process.pid);
2529
+ // The client can be started by Explorer, a startup shortcut, or a GUI shell
2530
+ // with a PATH that does not contain the Node installation. Update commands
2531
+ // must therefore receive the exact Node tool paths used by this launcher.
2532
+ env.LIVEDESK_NODE_EXECUTABLE = process.execPath;
2533
+ const nodeBinDir = dirname(process.execPath);
2534
+ const npxCandidates = process.platform === 'win32'
2535
+ ? [env.LIVEDESK_NPX_EXECUTABLE, join(nodeBinDir, 'npx.cmd'), join(nodeBinDir, 'npx.exe')]
2536
+ : [env.LIVEDESK_NPX_EXECUTABLE, join(nodeBinDir, 'npx')];
2537
+ const npxExecutable = npxCandidates.find(candidate => candidate && existsSync(candidate));
2538
+ if (npxExecutable) {
2539
+ env.LIVEDESK_NPX_EXECUTABLE = npxExecutable;
2540
+ }
2529
2541
  env.LIVEDESK_CLIENT_MANAGER = String(prepared?.manager || env.LIVEDESK_CLIENT_MANAGER || '');
2530
2542
  env.LIVEDESK_CLIENT_PAIR_TOKEN = String(prepared?.pair || env.LIVEDESK_CLIENT_PAIR_TOKEN || '');
2531
2543
  env.LIVEDESK_CLIENT_NAME = String(prepared?.name || env.LIVEDESK_CLIENT_NAME || '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.139",
3
+ "version": "0.1.140",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {