diff --git a/client/css/style.css b/client/css/style.css index f0487c55..5fa19b02 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -137,6 +137,10 @@ kbd { cursor: pointer; /* This is useful for ` + diff --git a/client/views/new_version.tpl b/client/views/new_version.tpl deleted file mode 100644 index 8825ed16..00000000 --- a/client/views/new_version.tpl +++ /dev/null @@ -1,6 +0,0 @@ -The Lounge {{latest.version}}{{#if latest.prerelease}} (pre-release){{/if}} -is now available. - - - Read more on GitHub - diff --git a/client/views/version_checker.tpl b/client/views/version_checker.tpl new file mode 100644 index 00000000..8b75d09f --- /dev/null +++ b/client/views/version_checker.tpl @@ -0,0 +1,27 @@ +{{#equal status "loading"}} +

+ Checking for updates... +

+{{else equal status "new-version"}} +

+ The Lounge {{latest.version}}{{#if latest.prerelease}} (pre-release){{/if}} + is now available. +
+ + + Read more on GitHub + +

+{{else equal status "up-to-date"}} +

+ The Lounge is up to date! +

+ + +{{else equal status "error"}} +

+ Information about latest releases could not be retrieved. +

+ + +{{/equal}} diff --git a/client/views/windows/changelog.tpl b/client/views/windows/changelog.tpl index 2ffd5c57..222a1a6b 100644 --- a/client/views/windows/changelog.tpl +++ b/client/views/windows/changelog.tpl @@ -4,15 +4,15 @@
« Help - {{#if current}} -

Release notes for {{current.version}}

+ {{#if version}} +

Release notes for {{version}}

- {{#if current.changelog}} + {{#if changelog}}

Introduction

-
{{{current.changelog}}}
+
{{{changelog}}}
{{else}}

Unable to retrieve releases from GitHub.

-

View release notes for this version on GitHub

+

View release notes for this version on GitHub

{{/if}} {{else}}

Loading changelog…

diff --git a/client/views/windows/help.tpl b/client/views/windows/help.tpl index 8f1e9b37..2802d89e 100644 --- a/client/views/windows/help.tpl +++ b/client/views/windows/help.tpl @@ -13,11 +13,7 @@
- {{#unless public}} -

- Checking for updates... -

- {{/unless}} +
{{#if gitCommit}}

diff --git a/src/plugins/changelog.js b/src/plugins/changelog.js index 9f604102..2103ded4 100644 --- a/src/plugins/changelog.js +++ b/src/plugins/changelog.js @@ -3,6 +3,8 @@ const pkg = require("../../package.json"); const request = require("request"); +const TIME_TO_LIVE = 15 * 60 * 1000; // 15 minutes, in milliseconds + module.exports = { fetch, }; @@ -67,12 +69,14 @@ function fetch(callback) { } } - // Emptying cached information after 15 minutes + // Add expiration date to the data to send to the client for later refresh + versions.expiresAt = Date.now() + TIME_TO_LIVE; + + // Emptying cached information after reaching said expiration date setTimeout(() => { delete versions.current.changelog; delete versions.latest; - }, 15 * 60 * 1000 - ); + }, TIME_TO_LIVE); callback(versions); });