diff --git a/config-sample.ini b/config-sample.ini index 8393c8725..7829089b1 100644 --- a/config-sample.ini +++ b/config-sample.ini @@ -1,5 +1,5 @@ [General] -# Instance name can be used to distinguish between different instances +# Instance name can be used to distinguish between different instances using backend api.getInstanceName() instanceName= # set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password) diff --git a/src/public/app/services/sync.js b/src/public/app/services/sync.js index d3b20e7e5..8076a7937 100644 --- a/src/public/app/services/sync.js +++ b/src/public/app/services/sync.js @@ -8,8 +8,8 @@ async function syncNow() { toastService.showMessage("Sync finished successfully."); } else { - if (result.message.length > 100) { - result.message = result.message.substr(0, 100); + if (result.message.length > 200) { + result.message = result.message.substr(0, 200) + "..."; } toastService.showError("Sync failed: " + result.message); diff --git a/src/services/data_encryption.js b/src/services/data_encryption.js index 104081910..9ef10f484 100644 --- a/src/services/data_encryption.js +++ b/src/services/data_encryption.js @@ -52,6 +52,10 @@ function encrypt(key, plainText, ivLength = 13) { } function decrypt(key, cipherText, ivLength = 13) { + if (cipherText === null) { + return null; + } + if (!key) { return "[protected]"; } @@ -93,6 +97,10 @@ function decrypt(key, cipherText, ivLength = 13) { function decryptString(dataKey, cipherText) { const buffer = decrypt(dataKey, cipherText); + if (buffer === null) { + return null; + } + const str = buffer.toString('utf-8'); if (str === 'false') { @@ -108,4 +116,4 @@ module.exports = { encrypt, decrypt, decryptString -}; \ No newline at end of file +}; diff --git a/src/services/handlers.js b/src/services/handlers.js index 96ee9e0dc..6ac5d5c1f 100644 --- a/src/services/handlers.js +++ b/src/services/handlers.js @@ -94,10 +94,10 @@ eventService.subscribe(eventService.CHILD_NOTE_CREATED, ({ parentNote, childNote function processInverseRelations(entityName, entity, handler) { if (entityName === 'attributes' && entity.type === 'relation') { const note = entity.getNote(); - const attributes = (note.getOwnedAttributes(entity.name)).filter(relation => relation.type === 'relation-definition'); + const relDefinitions = note.getLabels('relation:' + entity.name); - for (const attribute of attributes) { - const definition = attribute.value; + for (const relDefinition of relDefinitions) { + const definition = relDefinition.getDefinition(); if (definition.inverseRelation && definition.inverseRelation.trim()) { const targetNote = entity.getTargetNote(); diff --git a/src/services/protected_session.js b/src/services/protected_session.js index 6b351320c..3decbe960 100644 --- a/src/services/protected_session.js +++ b/src/services/protected_session.js @@ -49,10 +49,18 @@ function decryptNotes(notes) { } function encrypt(plainText) { + if (plainText === null) { + return null; + } + return dataEncryptionService.encrypt(getDataKey(), plainText); } function decrypt(cipherText) { + if (cipherText === null) { + return null; + } + return dataEncryptionService.decrypt(getDataKey(), cipherText); }