Notify all connected clients when new version is available
This commit is contained in:
parent
3f928d8742
commit
d5ac13f91c
@ -33,3 +33,7 @@ socket.on("changelog", function(data) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("changelog:newversion", () => {
|
||||
store.state.serverConfiguration.isUpdateAvailable = true;
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ function updateVersions(response) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkForUpdates() {
|
||||
function checkForUpdates(manager) {
|
||||
fetch().then((versionData) => {
|
||||
if (!module.exports.isUpdateAvailable) {
|
||||
// Check for updates every 24 hours + random jitter of <3 hours
|
||||
@ -106,5 +106,8 @@ function checkForUpdates() {
|
||||
versionData.latest.version
|
||||
)} is available. Read more on GitHub: ${versionData.latest.url}`
|
||||
);
|
||||
|
||||
// Notify all connected clients about the new version
|
||||
manager.clients.forEach((client) => client.emit("changelog:newversion"));
|
||||
});
|
||||
}
|
||||
|
@ -239,9 +239,9 @@ module.exports = function(options = {}) {
|
||||
if (Helper.config.prefetchStorage) {
|
||||
require("./plugins/storage").emptyDir();
|
||||
}
|
||||
});
|
||||
|
||||
changelog.checkForUpdates();
|
||||
changelog.checkForUpdates(manager);
|
||||
});
|
||||
|
||||
return server;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user