mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 03:53:08 +00:00
Notify all connected clients when new version is available
This commit is contained in:
parent
3f928d8742
commit
d5ac13f91c
3 changed files with 10 additions and 3 deletions
|
@ -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 a new issue