mirror of
https://github.com/zadam/trilium.git
synced 2025-01-09 16:49:11 +08:00
Introduced separate sync version (previously DB version was used to check sync compatibility), closes #120
This commit is contained in:
parent
14c704d6db
commit
d67246699a
5 changed files with 12 additions and 6 deletions
|
@ -173,6 +173,7 @@ addTabHandler((function () {
|
|||
addTabHandler((async function () {
|
||||
const $appVersion = $("#app-version");
|
||||
const $dbVersion = $("#db-version");
|
||||
const $syncVersion = $("#sync-version");
|
||||
const $buildDate = $("#build-date");
|
||||
const $buildRevision = $("#build-revision");
|
||||
|
||||
|
@ -180,6 +181,7 @@ addTabHandler((async function () {
|
|||
|
||||
$appVersion.html(appInfo.appVersion);
|
||||
$dbVersion.html(appInfo.dbVersion);
|
||||
$syncVersion.html(appInfo.syncVersion);
|
||||
$buildDate.html(appInfo.buildDate);
|
||||
$buildRevision.html(appInfo.buildRevision);
|
||||
$buildRevision.attr('href', 'https://github.com/zadam/trilium/commit/' + appInfo.buildRevision);
|
||||
|
|
|
@ -21,10 +21,10 @@ async function loginSync(req) {
|
|||
return [400, { message: 'Auth request time is out of sync' }];
|
||||
}
|
||||
|
||||
const dbVersion = req.body.dbVersion;
|
||||
const syncVersion = req.body.syncVersion;
|
||||
|
||||
if (dbVersion !== appInfo.dbVersion) {
|
||||
return [400, { message: 'Non-matching db versions, local is version ' + appInfo.dbVersion }];
|
||||
if (syncVersion !== appInfo.syncVersion) {
|
||||
return [400, { message: 'Non-matching sync versions, local is version ' + appInfo.syncVersion }];
|
||||
}
|
||||
|
||||
const documentSecret = await options.getOption('documentSecret');
|
||||
|
|
|
@ -4,10 +4,12 @@ const build = require('./build');
|
|||
const packageJson = require('../../package');
|
||||
|
||||
const APP_DB_VERSION = 99;
|
||||
const SYNC_VERSION = 1;
|
||||
|
||||
module.exports = {
|
||||
appVersion: packageJson.version,
|
||||
dbVersion: APP_DB_VERSION,
|
||||
syncVersion: SYNC_VERSION,
|
||||
buildDate: build.buildDate,
|
||||
buildRevision: build.buildRevision
|
||||
};
|
|
@ -69,7 +69,7 @@ async function login() {
|
|||
|
||||
const resp = await syncRequest(syncContext, 'POST', '/api/login/sync', {
|
||||
timestamp: timestamp,
|
||||
dbVersion: appInfo.dbVersion,
|
||||
syncVersion: appInfo.syncVersion,
|
||||
hash: hash
|
||||
});
|
||||
|
||||
|
|
|
@ -447,12 +447,14 @@
|
|||
<th>App version:</th>
|
||||
<td id="app-version"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>DB version:</th>
|
||||
<td id="db-version"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Sync version:</th>
|
||||
<td id="sync-version"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Build date:</th>
|
||||
<td id="build-date"></td>
|
||||
|
|
Loading…
Reference in a new issue