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

This commit is contained in:
azivner 2018-07-25 10:57:36 +02:00
parent 50bb4a47ee
commit d39cdbfada
5 changed files with 25 additions and 6 deletions

View file

@ -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();

View file

@ -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);

View file

@ -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);

View file

@ -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>

View file

@ -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>