Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Introduced separate sync version (previously DB version was used to check sync compatibility), closes #120
azivnerd67246699ad9
diff --git a/src/public/javascripts/dialogs/options.js b/src/public/javascripts/dialogs/options.jsindex acddb65a7f..7a1020e81e 100644--- a/src/public/javascripts/dialogs/options.js+++ b/src/public/javascripts/dialogs/options.js@@ -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);diff --git a/src/routes/api/login.js b/src/routes/api/login.jsindex 7ecb4ac18b..0c7f116344 100644--- a/src/routes/api/login.js+++ b/src/routes/api/login.js@@ -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');diff --git a/src/services/app_info.js b/src/services/app_info.jsindex 5a63ee9d3d..ba7e24ecf8 100644--- a/src/services/app_info.js+++ b/src/services/app_info.js@@ -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};\ No newline at end of filediff --git a/src/services/sync.js b/src/services/sync.jsindex 46def89ebc..5a7c47e549 100644--- a/src/services/sync.js+++ b/src/services/sync.js@@ -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});diff --git a/src/views/index.ejs b/src/views/index.ejsindex ff0f831315..443707f7a9 100644--- a/src/views/index.ejs+++ b/src/views/index.ejs@@ -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>