Browse Source

pull git repo info on startup; show git log date in footer

fix-133-memory-crash
Dan Janosik 7 years ago
parent
commit
c812b67e14
  1. 16
      app.js
  2. 1
      views/layout.pug

16
app.js

@ -101,6 +101,13 @@ app.runOnStartup = function() {
}); });
} }
if (global.sourcecodeVersion == null) {
simpleGit(".").log(["-n 1"], function(err, log) {
global.sourcecodeVersion = log.all[0].hash.substring(0, 10);
global.sourcecodeDate = log.all[0].date.substring(0, "0000-00-00".length);
});
}
if (global.exchangeRate == null) { if (global.exchangeRate == null) {
refreshExchangeRate(); refreshExchangeRate();
} }
@ -109,9 +116,6 @@ app.runOnStartup = function() {
setInterval(refreshExchangeRate, 1800000); setInterval(refreshExchangeRate, 1800000);
}; };
app.locals.sourcecodeVersion = null;
app.use(function(req, res, next) { app.use(function(req, res, next) {
// make session available in templates // make session available in templates
res.locals.session = req.session; res.locals.session = req.session;
@ -162,12 +166,6 @@ app.use(function(req, res, next) {
} }
} }
if (!req.session.sourcecodeVersion) {
simpleGit(".").log(["-n 1"], function(err, log) {
app.locals.sourcecodeVersion = log.all[0].hash.substring(0, 10);
});
}
if (req.session.userMessage) { if (req.session.userMessage) {
res.locals.userMessage = req.session.userMessage; res.locals.userMessage = req.session.userMessage;

1
views/layout.pug

@ -102,6 +102,7 @@ html
dt Running Version dt Running Version
dd dd
a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion} a(href=("https://github.com/janoside/btc-rpc-explorer/commit/" + sourcecodeVersion)) #{sourcecodeVersion}
span(style="color: #ccc;") (#{sourcecodeDate})
if (env.demoSite) if (env.demoSite)
dt Public Demos dt Public Demos

Loading…
Cancel
Save