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");