Skip to content

Build your personal knowledge base with Trilium Notes

better instructions for desktop => server instance sync setup, plus some sync fixes

azivnerd39cdbfada2d
diff --git a/src/public/javascripts/setup.js b/src/public/javascripts/setup.js
index daccd98ef2..06cc3dd0dc 100644
--- a/src/public/javascripts/setup.js
+++ b/src/public/javascripts/setup.js
@@ -5,6 +5,10 @@ function SetupModel() {
setInterval(checkOutstandingSyncs, 1000);
}
+ const serverAddress = location.protocol + '//' + location.host;
+
+ $("#current-host").html(serverAddress);
+
this.step = ko.observable(syncInProgress ? "sync-in-progress" : "setup-type");
this.setupType = ko.observable();
diff --git a/src/services/options_init.js b/src/services/options_init.js
index c54e55fb92..c8ab364df4 100644
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@ -29,7 +29,7 @@ async function initSyncedOptions(username, password) {
await passwordEncryptionService.setDataKey(password, utils.randomSecureToken(16));
}
-async function initNotSyncedOptions(initialized, startNotePath = '', syncServerHost = '', syncProxy = '') {
+async function initNotSyncedOptions(initialized, startNotePath = 'root', syncServerHost = '', syncProxy = '') {
await optionService.createOption('startNotePath', startNotePath, false);
await optionService.createOption('lastBackupDate', dateUtils.nowDate(), false);
await optionService.createOption('dbVersion', appInfo.dbVersion, false);
diff --git a/src/services/sync.js b/src/services/sync.js
index c4331b5a20..a36794f6ec 100644
--- a/src/services/sync.js
+++ b/src/services/sync.js
@@ -131,6 +131,12 @@ async function pushSync(syncContext) {
while (true) {
const syncs = await sql.getRows('SELECT * FROM sync WHERE id > ? LIMIT 1000', [lastSyncedPush]);
+ if (syncs.length === 0) {
+ log.info("Nothing to push");
+
+ break;
+ }
+
const filteredSyncs = syncs.filter(sync => {
if (sync.sourceId === syncContext.sourceId) {
// too noisy
@@ -149,11 +155,11 @@ async function pushSync(syncContext) {
});
if (filteredSyncs.length === 0) {
- log.info("Nothing to push");
-
+ // there still might be more syncs (because of batch limit), just all from current batch
+ // has been filtered out
await setLastSyncedPush(lastSyncedPush);
- break;
+ continue;
}
const syncRecords = await getSyncRecords(filteredSyncs);
diff --git a/src/views/index.ejs b/src/views/index.ejs
index 672ea6de19..b8d9316535 100644
--- a/src/views/index.ejs
+++ b/src/views/index.ejs
@@ -410,7 +410,7 @@
<form id="sync-setup-form">
<div class="form-group">
- <label for="sync-server-host">Sync server host</label>
+ <label for="sync-server-host">Server instance address</label>
<input class="form-control" id="sync-server-host" placeholder="https://<host>:<port>">
</div>
diff --git a/src/views/setup.ejs b/src/views/setup.ejs
index 25f131370f..83dd3933c0 100644
--- a/src/views/setup.ejs
+++ b/src/views/setup.ejs
@@ -57,7 +57,16 @@
<div data-bind="visible: step() == 'sync-from-desktop'">
<h2>Sync from Desktop</h2>
- <p>This setup needs to be initiated from the desktop instance, please open it, go to settings in the top right, click on sync tab and then click on Setup sync with server instance.</p>
+ <p>This setup needs to be initiated from the desktop instance:</p>
+
+ <ol>
+ <li>please open your desktop instance of Trilium Notes</li>
+ <li>click on Options button in the top right</li>
+ <li>click on Sync tab</li>
+ <li>configure server instance address to the: <span id="current-host"></span> and click save.</li>
+ <li>click on "Sync document to the server instance" button</li>
+ <li>once you've done all this, click <a href="/">here</a></li>
+ </ol>
<button type="button" data-bind="click: back" class="btn btn-default">Back</button>
</div>