Merge pull request #2517 from ether/version-on-admin-page
Puts Git revision on the info page
This commit is contained in:
commit
c481d135a5
4 changed files with 27 additions and 18 deletions
|
@ -10,24 +10,9 @@ var server;
|
|||
var serverName;
|
||||
|
||||
exports.createServer = function () {
|
||||
//try to get the git version
|
||||
var version = "";
|
||||
try
|
||||
{
|
||||
var rootPath = path.resolve(npm.dir, '..');
|
||||
var ref = fs.readFileSync(rootPath + "/.git/HEAD", "utf-8");
|
||||
var refPath = rootPath + "/.git/" + ref.substring(5, ref.indexOf("\n"));
|
||||
version = fs.readFileSync(refPath, "utf-8");
|
||||
version = version.substring(0, 7);
|
||||
console.log("Your Etherpad git version is " + version);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.warn("Can't get git version for server header\n" + e.message)
|
||||
}
|
||||
console.log("Report bugs at https://github.com/ether/etherpad-lite/issues")
|
||||
|
||||
serverName = "Etherpad " + version + " (http://etherpad.org)";
|
||||
serverName = "Etherpad " + settings.getGitCommit() + " (http://etherpad.org)";
|
||||
|
||||
exports.restartServer();
|
||||
|
||||
|
@ -38,7 +23,6 @@ exports.createServer = function () {
|
|||
else{
|
||||
console.warn("Admin username and password not set in settings.json. To access admin please uncomment and edit 'users' in settings.json");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.restartServer = function () {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var eejs = require('ep_etherpad-lite/node/eejs');
|
||||
var settings = require('ep_etherpad-lite/node/utils/Settings');
|
||||
var installer = require('ep_etherpad-lite/static/js/pluginfw/installer');
|
||||
var plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins');
|
||||
var _ = require('underscore');
|
||||
|
@ -15,7 +16,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins.html", render_args) );
|
||||
});
|
||||
args.app.get('/admin/plugins/info', function(req, res) {
|
||||
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html", {}) );
|
||||
var gitCommit = settings.getGitCommit();
|
||||
res.send( eejs.require("ep_etherpad-lite/templates/admin/plugins-info.html", {gitCommit:gitCommit}) );
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -179,6 +179,25 @@ exports.abiwordAvailable = function()
|
|||
}
|
||||
};
|
||||
|
||||
// Provide git version if available
|
||||
exports.getGitCommit = function() {
|
||||
var version = "";
|
||||
try
|
||||
{
|
||||
var rootPath = path.resolve(npm.dir, '..');
|
||||
var ref = fs.readFileSync(rootPath + "/.git/HEAD", "utf-8");
|
||||
var refPath = rootPath + "/.git/" + ref.substring(5, ref.indexOf("\n"));
|
||||
version = fs.readFileSync(refPath, "utf-8");
|
||||
version = version.substring(0, 7);
|
||||
console.log("Your Etherpad git version is " + version);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.warn("Can't get git version for server header\n" + e.message)
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
exports.reloadSettings = function reloadSettings() {
|
||||
// Discover where the settings file lives
|
||||
var settingsFilename = argv.settings || "settings.json";
|
||||
|
@ -261,3 +280,5 @@ exports.reloadSettings = function reloadSettings() {
|
|||
|
||||
// initially load settings
|
||||
exports.reloadSettings();
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
</div>
|
||||
|
||||
<div class="innerwrapper">
|
||||
<h2>Etherpad Git Commit</h2>
|
||||
<p><a href='https://github.com/ether/etherpad-lite/commit/<%= gitCommit %>'><%= gitCommit %></a></p>
|
||||
|
||||
<h2>Installed plugins</h2>
|
||||
<pre><%- plugins.formatPlugins().replace(", ","\n") %></pre>
|
||||
|
|
Loading…
Reference in a new issue