Merge remote-tracking branch 'origin/stable'

This commit is contained in:
zadam 2020-12-21 23:19:25 +01:00
commit 7dde78e98a
5 changed files with 23 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

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