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
sync check failure is now shown as error message in frontend
azivner643069e8d600
diff --git a/public/javascripts/messaging.js b/public/javascripts/messaging.jsindex adcf855656..5a81c3d71f 100644--- a/public/javascripts/messaging.js+++ b/public/javascripts/messaging.js@@ -42,6 +42,9 @@ const messaging = (function() {changesToPushCountEl.html(message.changesToPushCount);}+ else if (message.type === 'sync-hash-check-failed') {+ showError("Sync check failed!", 60000);+ }}function connectWebSocket() {diff --git a/public/javascripts/utils.js b/public/javascripts/utils.jsindex 000eae89ec..4d59a390a8 100644--- a/public/javascripts/utils.js+++ b/public/javascripts/utils.js@@ -17,7 +17,7 @@ function showMessage(message) {});}-function showError(message) {+function showError(message, delay = 10000) {console.log("error: ", message);$.notify({@@ -26,7 +26,7 @@ function showError(message) {},{// settingstype: 'danger',- delay: 10000+ delay: delay});}diff --git a/services/sync.js b/services/sync.jsindex 8eebbdf083..73c577b962 100644--- a/services/sync.js+++ b/services/sync.js@@ -4,7 +4,6 @@ const log = require('./log');const rp = require('request-promise');const sql = require('./sql');const options = require('./options');-const migration = require('./migration');const utils = require('./utils');const config = require('./config');const source_id = require('./source_id');@@ -14,6 +13,7 @@ const content_hash = require('./content_hash');const event_log = require('./event_log');const fs = require('fs');const app_info = require('./app_info');+const messaging = require('./messaging');const SYNC_SERVER = config['Sync']['syncServerHost'];const isSyncSetup = !!SYNC_SERVER;@@ -271,6 +271,8 @@ async function checkContentHash(syncContext) {log.info("Content hash check PASSED with value: " + localContentHash);}else {+ await messaging.sendMessage({type: 'sync-hash-check-failed'});+await event_log.addEvent("Content hash check FAILED. Local is " + localContentHash + ", remote is " + resp.content_hash);}}