livedesk 0.1.276 → 0.1.277

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.
@@ -37,12 +37,16 @@ function buildWindowsLegacyUpdateCommand({ manager, pair, name, slot, targetVers
37
37
  '$ErrorActionPreference = "Stop"',
38
38
  '$cursor = Get-CimInstance Win32_Process -Filter ("ProcessId={0}" -f $PID)',
39
39
  '$launcherPid = 0',
40
- 'for ($depth = 0; $depth -lt 12 -and $cursor; $depth++) {',
41
- ' $parent = Get-CimInstance Win32_Process -Filter ("ProcessId={0}" -f [int]$cursor.ParentProcessId)',
42
- ' if (-not $parent) { break }',
43
- ' $commandLine = [string]$parent.CommandLine',
44
- ' if ($commandLine -match "(?i)(livedesk-client\\.js|livedesk\\.js)") { $launcherPid = [int]$parent.ProcessId; break }',
45
- ' $cursor = $parent',
40
+ '$configuredLauncherPid = 0',
41
+ 'if ([int]::TryParse([string]$env:LIVEDESK_CLIENT_PARENT_PID, [ref]$configuredLauncherPid) -and $configuredLauncherPid -gt 1) { try { Get-Process -Id $configuredLauncherPid -ErrorAction Stop | Out-Null; $launcherPid = $configuredLauncherPid } catch {} }',
42
+ 'if ($launcherPid -le 0) {',
43
+ ' for ($depth = 0; $depth -lt 12 -and $cursor; $depth++) {',
44
+ ' $parent = Get-CimInstance Win32_Process -Filter ("ProcessId={0}" -f [int]$cursor.ParentProcessId)',
45
+ ' if (-not $parent) { break }',
46
+ ' $commandLine = [string]$parent.CommandLine',
47
+ ' if ($commandLine -match "(?i)(livedesk-client\\.js|livedesk\\.js)") { $launcherPid = [int]$parent.ProcessId; break }',
48
+ ' $cursor = $parent',
49
+ ' }',
46
50
  '}',
47
51
  'if ($launcherPid -le 0) { throw "LiveDesk client launcher process was not found." }',
48
52
  `$env:LIVEDESK_CLIENT_MANAGER = ${quotePowerShell(manager)}`,
@@ -50,8 +54,11 @@ function buildWindowsLegacyUpdateCommand({ manager, pair, name, slot, targetVers
50
54
  `$env:LIVEDESK_CLIENT_NAME = ${quotePowerShell(name)}`,
51
55
  `$env:LIVEDESK_CLIENT_SLOT = ${quotePowerShell(slot || '')}`,
52
56
  `$env:LIVEDESK_CLIENT_UPDATE_TARGET_VERSION = ${quotePowerShell(targetVersion)}`,
53
- '$npx = (Get-Command npx.cmd -ErrorAction SilentlyContinue).Source',
54
- 'if (-not $npx) { $npx = "npx.cmd" }',
57
+ '$npx = [string]$env:LIVEDESK_NPX_EXECUTABLE',
58
+ 'if ($npx -and -not (Test-Path -LiteralPath $npx -PathType Leaf)) { $npx = "" }',
59
+ 'if (-not $npx) { $node = [string]$env:LIVEDESK_NODE_EXECUTABLE; if ($node -and (Test-Path -LiteralPath $node -PathType Leaf)) { $npx = Join-Path (Split-Path -Parent $node) "npx.cmd" } }',
60
+ 'if (-not $npx) { $npx = (Get-Command npx.cmd -ErrorAction SilentlyContinue).Source }',
61
+ 'if (-not $npx) { throw "LiveDesk npx executable was not found." }',
55
62
  'Start-Process -FilePath $npx -ArgumentList @("-y", "--prefer-online", "livedesk@latest", "client", "--no-login", "--update-wait-pid", [string]$launcherPid) -WindowStyle Hidden',
56
63
  'Start-Sleep -Milliseconds 500',
57
64
  'Start-Process -FilePath "taskkill.exe" -ArgumentList @("/PID", [string]$launcherPid, "/T", "/F") -WindowStyle Hidden',
@@ -86,7 +93,10 @@ function buildUnixLegacyUpdateCommand({ manager, pair, name, slot, targetVersion
86
93
  'updater.once("spawn", () => { updater.unref(); if (waitPid !== process.pid) setTimeout(() => { try { process.kill(waitPid, "SIGTERM"); } catch {} }, 500); });',
87
94
  ''
88
95
  ].join('\n');
89
- return `node -e ${JSON.stringify(script)}`;
96
+ return [
97
+ 'if [ -n "$LIVEDESK_NODE_EXECUTABLE" ]; then node_bin="$LIVEDESK_NODE_EXECUTABLE"; else node_bin="node"; fi',
98
+ `"$node_bin" -e ${JSON.stringify(script)}`
99
+ ].join('\n');
90
100
  }
91
101
 
92
102
  function buildLegacyUpdateCommand(device, credentials, targetVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.276",
3
+ "version": "0.1.277",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
34
- "@livedesk/client": "0.1.139",
34
+ "@livedesk/client": "0.1.140",
35
35
  "@openai/codex-sdk": "0.144.5",
36
36
  "cors": "^2.8.5",
37
37
  "express": "^4.21.2",