Add checks for updated version on disk

This commit is contained in:
Cooldude2606 committed 2025-04-27 23:57:58 +01:00
1 parent 96c5f33dbe
commit c120443657
5 files changed
+42 -1

No files matched your search

+12
View File
@@ -523,6 +523,18 @@ export default class Controller {
}
requests.push(hostConnection.send(new lib.SystemInfoRequest()));
}
if (!this.config.restartRequired) {
// If a restart isn't already required, then test if a new version is installed
try {
const runningVersion = this.config.get("controller.version");
const packageJson = await fs.readJSON(path.join(__dirname, "..", "package.json"));
if (runningVersion !== packageJson.version) {
this.config.restartRequired = true;
}
} catch (err: any) {
logger.warn(`Failed to read package json:\n${err.stack ?? err.message}`);
}
}
requests.push(lib.gatherSystemInfo("controller", this.canRestart, this.config.restartRequired));
const newMetrics = await Promise.all(requests);
for (const metric of newMetrics) {