mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	added app and db versions to about dialog in settings
This commit is contained in:
		
							parent
							
								
									fed1cab2c9
								
							
						
					
					
						commit
						7e3fd2f63e
					
				@ -152,13 +152,17 @@ settings.addModule((function () {
 | 
			
		||||
})());
 | 
			
		||||
 | 
			
		||||
settings.addModule((function () {
 | 
			
		||||
    const appVersionEl = $("#app-version");
 | 
			
		||||
    const dbVersionEl = $("#db-version");
 | 
			
		||||
    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']);
 | 
			
		||||
        appVersionEl.html(settings.app_version);
 | 
			
		||||
        dbVersionEl.html(settings.db_version);
 | 
			
		||||
        buildDateEl.html(settings.build_date);
 | 
			
		||||
        buildRevisionEl.html(settings.build_revision);
 | 
			
		||||
        buildRevisionEl.attr('href', 'https://github.com/zadam/trilium/commit/' + settings.build_revision);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
 | 
			
		||||
@ -8,14 +8,23 @@ const audit_category = require('../../services/audit_category');
 | 
			
		||||
const auth = require('../../services/auth');
 | 
			
		||||
const utils = require('../../services/utils');
 | 
			
		||||
const build = require('../../services/build');
 | 
			
		||||
const packageJson = require('../../package');
 | 
			
		||||
const migration = require('../../services/migration');
 | 
			
		||||
 | 
			
		||||
// options allowed to be updated directly in settings dialog
 | 
			
		||||
const ALLOWED_OPTIONS = ['protected_session_timeout', 'history_snapshot_time_interval'];
 | 
			
		||||
 | 
			
		||||
function addExtraSettings(settings) {
 | 
			
		||||
    Object.assign(settings, build);
 | 
			
		||||
 | 
			
		||||
    settings['app_version'] = packageJson.version;
 | 
			
		||||
    settings['db_version'] = migration.APP_DB_VERSION;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
    addExtraSettings(settings);
 | 
			
		||||
 | 
			
		||||
    res.send(settings);
 | 
			
		||||
});
 | 
			
		||||
@ -24,7 +33,7 @@ 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);
 | 
			
		||||
    addExtraSettings(settings);
 | 
			
		||||
 | 
			
		||||
    res.send(settings);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
module.exports = { buildDate:"2017-11-16T19:29:52-05:00", buildRevision: "c371ffb5974d8dccaec76c78dfa91dd54fcc624e" };
 | 
			
		||||
module.exports = { build_date:"2017-11-16T19:29:52-05:00", build_revision: "c371ffb5974d8dccaec76c78dfa91dd54fcc624e" };
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,3 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
echo 'module.exports = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > services/build.js
 | 
			
		||||
echo 'module.exports = { build_date:"'`date --iso-8601=seconds`'", build_revision: "'`git log -1 --format="%H"`'" };' > services/build.js
 | 
			
		||||
@ -202,6 +202,16 @@
 | 
			
		||||
        </div>
 | 
			
		||||
        <div id="about">
 | 
			
		||||
          <table class="table">
 | 
			
		||||
            <tr>
 | 
			
		||||
              <th>App version:</th>
 | 
			
		||||
              <td id="app-version"></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
 | 
			
		||||
            <tr>
 | 
			
		||||
              <th>DB version:</th>
 | 
			
		||||
              <td id="db-version"></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
 | 
			
		||||
            <tr>
 | 
			
		||||
              <th>Build date:</th>
 | 
			
		||||
              <td id="build-date"></td>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user