livedesk 0.1.596 → 0.1.597

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.
Files changed (2) hide show
  1. package/hub/src/server.js +36 -35
  2. package/package.json +1 -1
package/hub/src/server.js CHANGED
@@ -817,16 +817,18 @@ function getLiveDeskUpdateStatus() {
817
817
  };
818
818
  }
819
819
 
820
- if (process.env.LIVEDESK_DESKTOP_HOST !== '1') {
821
- liveDeskUpdateManager = createLiveDeskUpdateManager({
822
- remoteHub,
823
- currentManagerVersion: process.env.LIVEDESK_MANAGER_VERSION || packageInfo.version,
824
- currentClientVersion: process.env.LIVEDESK_CLIENT_PACKAGE_VERSION || '',
825
- excludedDeviceIds: [runtimeDeviceId],
826
- restartSupported: !!String(process.env.LIVEDESK_HUB_UPDATE_REQUEST_PATH || '').trim(),
827
- requestHubRestart
828
- });
829
- }
820
+ const electronDesktopOwnsSelfUpdate = process.env.LIVEDESK_DESKTOP_HOST === '1';
821
+ liveDeskUpdateManager = createLiveDeskUpdateManager({
822
+ remoteHub,
823
+ currentManagerVersion: process.env.LIVEDESK_MANAGER_VERSION || packageInfo.version,
824
+ currentClientVersion: process.env.LIVEDESK_CLIENT_PACKAGE_VERSION || '',
825
+ excludedDeviceIds: [runtimeDeviceId],
826
+ // electron-updater owns replacement of the installed desktop application.
827
+ // The same Hub still needs the fleet manager for connected outdated Clients.
828
+ restartSupported: !electronDesktopOwnsSelfUpdate
829
+ && !!String(process.env.LIVEDESK_HUB_UPDATE_REQUEST_PATH || '').trim(),
830
+ requestHubRestart: electronDesktopOwnsSelfUpdate ? undefined : requestHubRestart
831
+ });
830
832
 
831
833
  if (process.env.LIVEDESK_UPDATE_CONTINUE === '1') {
832
834
  let continueUpdateInFlight = false;
@@ -5010,31 +5012,30 @@ app.post('/api/runtime/role', async (req, res) => {
5010
5012
  }
5011
5013
  });
5012
5014
 
5013
- app.get('/api/update/status', (_req, res) => {
5014
- noStore(res);
5015
- if (process.env.LIVEDESK_DESKTOP_HOST === '1') {
5016
- res.json({
5017
- updateAvailable: false,
5018
- state: 'electron-managed',
5019
- canApply: false,
5020
- disabled: true,
5021
- restartResult: readHubRestartResult()
5022
- });
5023
- return;
5024
- }
5025
- res.json(getLiveDeskUpdateStatus());
5026
- });
5027
-
5028
- app.post('/api/update/apply', async (_req, res) => {
5029
- noStore(res);
5030
- if (process.env.LIVEDESK_DESKTOP_HOST === '1') {
5031
- res.status(409).json({ ok: false, error: 'electron-updater-managed', disabled: true });
5032
- return;
5033
- }
5034
- try {
5035
- liveDeskUpdateManager?.reconcileHubRestartResult(readHubRestartResult());
5036
- const result = await liveDeskUpdateManager?.startUpdate();
5037
- res.status(result?.ok === false ? 409 : 200).json(result || { ok: false, error: 'update-manager-unavailable' });
5015
+ app.get('/api/update/status', (_req, res) => {
5016
+ noStore(res);
5017
+ res.json({
5018
+ ...getLiveDeskUpdateStatus(),
5019
+ selfUpdateOwner: electronDesktopOwnsSelfUpdate ? 'electron-updater' : 'npm-launcher'
5020
+ });
5021
+ });
5022
+
5023
+ app.post('/api/update/apply', async (_req, res) => {
5024
+ noStore(res);
5025
+ try {
5026
+ liveDeskUpdateManager?.reconcileHubRestartResult(readHubRestartResult());
5027
+ const updateStatus = liveDeskUpdateManager?.getStatus();
5028
+ if (electronDesktopOwnsSelfUpdate
5029
+ && (updateStatus?.managerUpdateAvailable || updateStatus?.clientPackageUpdateAvailable)) {
5030
+ res.status(409).json({
5031
+ ok: false,
5032
+ error: 'electron-updater-managed',
5033
+ selfUpdateOwner: 'electron-updater'
5034
+ });
5035
+ return;
5036
+ }
5037
+ const result = await liveDeskUpdateManager?.startUpdate();
5038
+ res.status(result?.ok === false ? 409 : 200).json(result || { ok: false, error: 'update-manager-unavailable' });
5038
5039
  } catch (error) {
5039
5040
  res.status(500).json({ ok: false, error: error instanceof Error ? error.message : String(error) });
5040
5041
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.596",
3
+ "version": "0.1.597",
4
4
  "livedeskClientVersion": "0.1.253",
5
5
  "buildFlavor": "production",
6
6
  "description": "VuvoDesk Hub and client launcher",