mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	Merge branch 'stable'
This commit is contained in:
		
							
								
								
									
										2
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								build.sh
									
									
									
									
									
								
							@@ -1,5 +1,7 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					./set-build.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Deleting dist"
 | 
					echo "Deleting dist"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rm -r dist/*
 | 
					rm -r dist/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,7 @@ const settings = (function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        dialogEl.dialog({
 | 
					        dialogEl.dialog({
 | 
				
			||||||
            modal: true,
 | 
					            modal: true,
 | 
				
			||||||
            width: 600
 | 
					            width: 800
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tabsEl.tabs();
 | 
					        tabsEl.tabs();
 | 
				
			||||||
@@ -150,3 +150,18 @@ settings.addModule((function () {
 | 
				
			|||||||
        settingsLoaded
 | 
					        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
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					})());
 | 
				
			||||||
@@ -7,6 +7,7 @@ const options = require('../../services/options');
 | 
				
			|||||||
const audit_category = require('../../services/audit_category');
 | 
					const audit_category = require('../../services/audit_category');
 | 
				
			||||||
const auth = require('../../services/auth');
 | 
					const auth = require('../../services/auth');
 | 
				
			||||||
const utils = require('../../services/utils');
 | 
					const utils = require('../../services/utils');
 | 
				
			||||||
 | 
					const build = require('../../services/build');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// options allowed to be updated directly in settings dialog
 | 
					// options allowed to be updated directly in settings dialog
 | 
				
			||||||
const ALLOWED_OPTIONS = ['encryption_session_timeout', 'history_snapshot_time_interval'];
 | 
					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) => {
 | 
					router.get('/all', auth.checkApiAuth, async (req, res, next) => {
 | 
				
			||||||
    const settings = await sql.getMap("SELECT opt_name, opt_value FROM options");
 | 
					    const settings = await sql.getMap("SELECT opt_name, opt_value FROM options");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Object.assign(settings, build);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.send(settings);
 | 
					    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 ("
 | 
					    const settings = await sql.getMap("SELECT opt_name, opt_value FROM options WHERE opt_name IN ("
 | 
				
			||||||
        + ALLOWED_OPTIONS.map(x => '?').join(",") + ")", ALLOWED_OPTIONS);
 | 
					        + ALLOWED_OPTIONS.map(x => '?').join(",") + ")", ALLOWED_OPTIONS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Object.assign(settings, build);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.send(settings);
 | 
					    res.send(settings);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								services/build.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								services/build.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					module.exports = { buildDate:"2017-11-13T23:36:03-05:00", buildRevision: "fbce84e779951056c0e8b4d5395ee2fbe426555e" };
 | 
				
			||||||
@@ -14,6 +14,7 @@ const syncUpdate = require('./sync_update');
 | 
				
			|||||||
const SYNC_SERVER = config['Sync']['syncServerHost'];
 | 
					const SYNC_SERVER = config['Sync']['syncServerHost'];
 | 
				
			||||||
const isSyncSetup = !!SYNC_SERVER;
 | 
					const isSyncSetup = !!SYNC_SERVER;
 | 
				
			||||||
const SYNC_TIMEOUT = config['Sync']['syncServerTimeout'] || 5000;
 | 
					const SYNC_TIMEOUT = config['Sync']['syncServerTimeout'] || 5000;
 | 
				
			||||||
 | 
					const SYNC_PROXY = config['Sync']['syncProxy'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let syncInProgress = false;
 | 
					let syncInProgress = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -215,14 +216,20 @@ async function syncRequest(syncContext, method, uri, body) {
 | 
				
			|||||||
    const fullUri = SYNC_SERVER + uri;
 | 
					    const fullUri = SYNC_SERVER + uri;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        return await rp({
 | 
					        const options = {
 | 
				
			||||||
            method: method,
 | 
					            method: method,
 | 
				
			||||||
            uri: fullUri,
 | 
					            uri: fullUri,
 | 
				
			||||||
            jar: syncContext.cookieJar,
 | 
					            jar: syncContext.cookieJar,
 | 
				
			||||||
            json: true,
 | 
					            json: true,
 | 
				
			||||||
            body: body,
 | 
					            body: body,
 | 
				
			||||||
            timeout: SYNC_TIMEOUT
 | 
					            timeout: SYNC_TIMEOUT
 | 
				
			||||||
        });
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (SYNC_PROXY) {
 | 
				
			||||||
 | 
					            options.proxy = SYNC_PROXY;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return await rp(options);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    catch (e) {
 | 
					    catch (e) {
 | 
				
			||||||
        throw new Error("Request to " + method + " " + fullUri + " failed, inner exception: " + e.stack);
 | 
					        throw new Error("Request to " + method + " " + fullUri + " failed, inner exception: " + e.stack);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								set-build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								set-build.sh
									
									
									
									
									
										Executable file
									
								
							@@ -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
 | 
				
			||||||
@@ -153,6 +153,7 @@
 | 
				
			|||||||
          <li><a href="#change-password">Change password</a></li>
 | 
					          <li><a href="#change-password">Change password</a></li>
 | 
				
			||||||
          <li><a href="#encryption-timeout">Encryption timeout</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="#history-snapshot-time-interval">History snapshots</a></li>
 | 
				
			||||||
 | 
					          <li><a href="#about">About Trilium</a></li>
 | 
				
			||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
        <div id="change-password">
 | 
					        <div id="change-password">
 | 
				
			||||||
          <form id="change-password-form">
 | 
					          <form id="change-password-form">
 | 
				
			||||||
@@ -199,6 +200,19 @@
 | 
				
			|||||||
            <button class="btn btn-sm">Save</button>
 | 
					            <button class="btn btn-sm">Save</button>
 | 
				
			||||||
          </form>
 | 
					          </form>
 | 
				
			||||||
        </div>
 | 
					        </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>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user