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.
- package/hub/src/server.js +36 -35
- package/package.json +1 -1
package/hub/src/server.js
CHANGED
|
@@ -817,16 +817,18 @@ function getLiveDeskUpdateStatus() {
|
|
|
817
817
|
};
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
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
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
liveDeskUpdateManager?.
|
|
5036
|
-
|
|
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
|
}
|