Display whether instance is running from a release or from git on About section
This commit is contained in:
parent
3ed1768a06
commit
71577cf55e
@ -324,8 +324,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<p class="about">
|
<p class="about">
|
||||||
|
<% if (gitCommit) { %>
|
||||||
|
The Lounge is running from source
|
||||||
|
(<a href="https://github.com/thelounge/lounge/tree/<%= gitCommit %>" target="_blank"><code><%= gitCommit %></code></a>).<br>
|
||||||
|
<% } else { %>
|
||||||
The Lounge is in version <strong><%= version %></strong>
|
The Lounge is in version <strong><%= version %></strong>
|
||||||
(<a href="https://github.com/thelounge/lounge/releases/tag/v<%= version %>" target="_blank">See release notes</a>).<br>
|
(<a href="https://github.com/thelounge/lounge/releases/tag/v<%= version %>" target="_blank">See release notes</a>).<br>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<a href="https://thelounge.github.io/" target="_blank">Website</a><br>
|
<a href="https://thelounge.github.io/" target="_blank">Website</a><br>
|
||||||
<a href="https://thelounge.github.io/docs/" target="_blank">Documentation</a><br>
|
<a href="https://thelounge.github.io/docs/" target="_blank">Documentation</a><br>
|
||||||
|
@ -80,6 +80,16 @@ function allRequests(req, res, next) {
|
|||||||
return 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) {
|
function index(req, res, next) {
|
||||||
if (req.url.split("?")[0] !== "/") {
|
if (req.url.split("?")[0] !== "/") {
|
||||||
return next();
|
return next();
|
||||||
@ -90,6 +100,7 @@ function index(req, res, next) {
|
|||||||
pkg,
|
pkg,
|
||||||
Helper.config
|
Helper.config
|
||||||
);
|
);
|
||||||
|
data.gitCommit = gitCommit;
|
||||||
var template = _.template(file);
|
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-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");
|
res.setHeader("Content-Type", "text/html");
|
||||||
|
Loading…
Reference in New Issue
Block a user