From 844a55d29041a8556966511c4055019df779d8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Wed, 13 Jul 2016 02:09:23 -0400 Subject: [PATCH 1/3] Improve version text and link in About section in the UI --- client/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 40147adf..38ff8929 100644 --- a/client/index.html +++ b/client/index.html @@ -324,8 +324,8 @@

- You're currently running version <%= version %>
- View the change log + The Lounge is in version <%= version %> + (See release notes).

From 3ed1768a06b5cb0f04723491a89a35fdfd8b9cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Wed, 13 Jul 2016 02:10:26 -0400 Subject: [PATCH 2/3] Add useful links in About section in the UI --- client/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/index.html b/client/index.html index 38ff8929..715ea8fa 100644 --- a/client/index.html +++ b/client/index.html @@ -326,6 +326,10 @@

The Lounge is in version <%= version %> (See release notes).
+ + Website
+ Documentation
+ Report a bug

From 71577cf55ed6c730bbd63960b36c88875806083a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Wed, 13 Jul 2016 03:17:55 -0400 Subject: [PATCH 3/3] Display whether instance is running from a release or from git on About section --- client/index.html | 9 +++++++-- src/server.js | 11 +++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 715ea8fa..7dc30c7c 100644 --- a/client/index.html +++ b/client/index.html @@ -324,8 +324,13 @@

- The Lounge is in version <%= version %> - (See release notes).
+ <% if (gitCommit) { %> + The Lounge is running from source + (<%= gitCommit %>).
+ <% } else { %> + The Lounge is in version <%= version %> + (See release notes).
+ <% } %> Website
Documentation
diff --git a/src/server.js b/src/server.js index 03f7436e..58beaeed 100644 --- a/src/server.js +++ b/src/server.js @@ -80,6 +80,16 @@ function allRequests(req, res, next) { return next(); } +// Information to populate the About section in UI, either from npm or from git +try { + var gitCommit = require("child_process") + .execSync("git rev-parse --short HEAD") // Returns hash of current commit + .toString() + .trim(); +} catch (e) { + // Not a git repository or git is not installed: treat it as npm release +} + function index(req, res, next) { if (req.url.split("?")[0] !== "/") { return next(); @@ -90,6 +100,7 @@ function index(req, res, next) { pkg, Helper.config ); + data.gitCommit = gitCommit; var template = _.template(file); res.setHeader("Content-Security-Policy", "default-src *; style-src * 'unsafe-inline'; script-src 'self'; child-src 'none'; object-src 'none'; form-action 'none'; referrer no-referrer;"); res.setHeader("Content-Type", "text/html");