Skip to content

Build your personal knowledge base with Trilium Notes

added build date & revision

azivnerfbce84e77995
diff --git a/public/javascripts/dialogs/settings.js b/public/javascripts/dialogs/settings.js
index 63ae5aa516..892352b22d 100644
--- a/public/javascripts/dialogs/settings.js
+++ b/public/javascripts/dialogs/settings.js
@@ -21,7 +21,7 @@ const settings = (function() {
dialogEl.dialog({
modal: true,
- width: 600
+ width: 800
});
tabsEl.tabs();
@@ -148,6 +148,21 @@ settings.addModule((function () {
return false;
});
+ return {
+ settingsLoaded
+ };
+})());
+
+settings.addModule((function () {
+ const buildDateEl = $("#build-date");
+ const buildRevisionEl = $("#build-revision");
+
+ function settingsLoaded(settings) {
+ buildDateEl.html(settings['buildDate']);
+ buildRevisionEl.html(settings['buildRevision']);
+ buildRevisionEl.attr('href', 'https://github.com/zadam/trilium/commit/' + settings['buildRevision']);
+ }
+
return {
settingsLoaded
};
diff --git a/routes/api/settings.js b/routes/api/settings.js
index db08232a3b..998f778ce2 100644
--- a/routes/api/settings.js
+++ b/routes/api/settings.js
@@ -7,6 +7,7 @@ const options = require('../../services/options');
const audit_category = require('../../services/audit_category');
const auth = require('../../services/auth');
const utils = require('../../services/utils');
+const build = require('../../services/build');
// options allowed to be updated directly in settings dialog
const ALLOWED_OPTIONS = ['encryption_session_timeout', 'history_snapshot_time_interval'];
@@ -14,6 +15,8 @@ const ALLOWED_OPTIONS = ['encryption_session_timeout', 'history_snapshot_time_in
router.get('/all', auth.checkApiAuth, async (req, res, next) => {
const settings = await sql.getMap("SELECT opt_name, opt_value FROM options");
+ Object.assign(settings, build);
+
res.send(settings);
});
@@ -21,6 +24,8 @@ router.get('/', auth.checkApiAuth, async (req, res, next) => {
const settings = await sql.getMap("SELECT opt_name, opt_value FROM options WHERE opt_name IN ("
+ ALLOWED_OPTIONS.map(x => '?').join(",") + ")", ALLOWED_OPTIONS);
+ Object.assign(settings, build);
+
res.send(settings);
});
diff --git a/services/build.js b/services/build.js
new file mode 100644
index 0000000000..1ce48d712b
--- /dev/null
+++ b/services/build.js
@@ -0,0 +1 @@
+module.exports = { buildDate:"2017-11-13T23:17:28-05:00", buildRevision: "f9056c6754293da6dc2803eb7f04e0902f08be6f" };
diff --git a/set-build.sh b/set-build.sh
new file mode 100755
index 0000000000..3f59e790ba
--- /dev/null
+++ b/set-build.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+echo 'module.exports = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > services/build.js
\ No newline at end of file
diff --git a/views/index.ejs b/views/index.ejs
index 93f2e04248..bf83852c66 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -153,6 +153,7 @@
<li><a href="#change-password">Change password</a></li>
<li><a href="#encryption-timeout">Encryption timeout</a></li>
<li><a href="#history-snapshot-time-interval">History snapshots</a></li>
+ <li><a href="#about">About Trilium</a></li>
</ul>
<div id="change-password">
<form id="change-password-form">
@@ -199,6 +200,19 @@
<button class="btn btn-sm">Save</button>
</form>
</div>
+ <div id="about">
+ <table class="table">
+ <tr>
+ <th>Build date:</th>
+ <td id="build-date"></td>
+ </tr>
+
+ <tr>
+ <th>Build revision:</th>
+ <td><a href="" target="_blank" id="build-revision"></a></td>
+ </tr>
+ </table>
+ </div>
</div>
</div>