diff --git a/src/public/javascripts/setup.js b/src/public/javascripts/setup.js index daccd98ef..06cc3dd0d 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 c54e55fb9..c8ab364df 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 c4331b5a2..a36794f6e 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 672ea6de1..b8d931653 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -410,7 +410,7 @@