mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01: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
@ -173,6 +173,7 @@ addTabHandler((function () {
|
|||||||
addTabHandler((async function () {
|
addTabHandler((async function () {
|
||||||
const $appVersion = $("#app-version");
|
const $appVersion = $("#app-version");
|
||||||
const $dbVersion = $("#db-version");
|
const $dbVersion = $("#db-version");
|
||||||
|
const $syncVersion = $("#sync-version");
|
||||||
const $buildDate = $("#build-date");
|
const $buildDate = $("#build-date");
|
||||||
const $buildRevision = $("#build-revision");
|
const $buildRevision = $("#build-revision");
|
||||||
|
|
||||||
@ -180,6 +181,7 @@ addTabHandler((async function () {
|
|||||||
|
|
||||||
$appVersion.html(appInfo.appVersion);
|
$appVersion.html(appInfo.appVersion);
|
||||||
$dbVersion.html(appInfo.dbVersion);
|
$dbVersion.html(appInfo.dbVersion);
|
||||||
|
$syncVersion.html(appInfo.syncVersion);
|
||||||
$buildDate.html(appInfo.buildDate);
|
$buildDate.html(appInfo.buildDate);
|
||||||
$buildRevision.html(appInfo.buildRevision);
|
$buildRevision.html(appInfo.buildRevision);
|
||||||
$buildRevision.attr('href', 'https://github.com/zadam/trilium/commit/' + 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' }];
|
return [400, { message: 'Auth request time is out of sync' }];
|
||||||
}
|
}
|
||||||
|
|
||||||
const dbVersion = req.body.dbVersion;
|
const syncVersion = req.body.syncVersion;
|
||||||
|
|
||||||
if (dbVersion !== appInfo.dbVersion) {
|
if (syncVersion !== appInfo.syncVersion) {
|
||||||
return [400, { message: 'Non-matching db versions, local is version ' + appInfo.dbVersion }];
|
return [400, { message: 'Non-matching sync versions, local is version ' + appInfo.syncVersion }];
|
||||||
}
|
}
|
||||||
|
|
||||||
const documentSecret = await options.getOption('documentSecret');
|
const documentSecret = await options.getOption('documentSecret');
|
||||||
|
@ -4,10 +4,12 @@ const build = require('./build');
|
|||||||
const packageJson = require('../../package');
|
const packageJson = require('../../package');
|
||||||
|
|
||||||
const APP_DB_VERSION = 99;
|
const APP_DB_VERSION = 99;
|
||||||
|
const SYNC_VERSION = 1;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
appVersion: packageJson.version,
|
appVersion: packageJson.version,
|
||||||
dbVersion: APP_DB_VERSION,
|
dbVersion: APP_DB_VERSION,
|
||||||
|
syncVersion: SYNC_VERSION,
|
||||||
buildDate: build.buildDate,
|
buildDate: build.buildDate,
|
||||||
buildRevision: build.buildRevision
|
buildRevision: build.buildRevision
|
||||||
};
|
};
|
@ -69,7 +69,7 @@ async function login() {
|
|||||||
|
|
||||||
const resp = await syncRequest(syncContext, 'POST', '/api/login/sync', {
|
const resp = await syncRequest(syncContext, 'POST', '/api/login/sync', {
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
dbVersion: appInfo.dbVersion,
|
syncVersion: appInfo.syncVersion,
|
||||||
hash: hash
|
hash: hash
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -447,12 +447,14 @@
|
|||||||
<th>App version:</th>
|
<th>App version:</th>
|
||||||
<td id="app-version"></td>
|
<td id="app-version"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>DB version:</th>
|
<th>DB version:</th>
|
||||||
<td id="db-version"></td>
|
<td id="db-version"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Sync version:</th>
|
||||||
|
<td id="sync-version"></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Build date:</th>
|
<th>Build date:</th>
|
||||||
<td id="build-date"></td>
|
<td id="build-date"></td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user