mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
commit
7dde78e98a
@ -1,5 +1,5 @@
|
|||||||
[General]
|
[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=
|
instanceName=
|
||||||
|
|
||||||
# set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)
|
# set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)
|
||||||
|
@ -8,8 +8,8 @@ async function syncNow() {
|
|||||||
toastService.showMessage("Sync finished successfully.");
|
toastService.showMessage("Sync finished successfully.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (result.message.length > 100) {
|
if (result.message.length > 200) {
|
||||||
result.message = result.message.substr(0, 100);
|
result.message = result.message.substr(0, 200) + "...";
|
||||||
}
|
}
|
||||||
|
|
||||||
toastService.showError("Sync failed: " + result.message);
|
toastService.showError("Sync failed: " + result.message);
|
||||||
|
@ -52,6 +52,10 @@ function encrypt(key, plainText, ivLength = 13) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function decrypt(key, cipherText, ivLength = 13) {
|
function decrypt(key, cipherText, ivLength = 13) {
|
||||||
|
if (cipherText === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
return "[protected]";
|
return "[protected]";
|
||||||
}
|
}
|
||||||
@ -93,6 +97,10 @@ function decrypt(key, cipherText, ivLength = 13) {
|
|||||||
function decryptString(dataKey, cipherText) {
|
function decryptString(dataKey, cipherText) {
|
||||||
const buffer = decrypt(dataKey, cipherText);
|
const buffer = decrypt(dataKey, cipherText);
|
||||||
|
|
||||||
|
if (buffer === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const str = buffer.toString('utf-8');
|
const str = buffer.toString('utf-8');
|
||||||
|
|
||||||
if (str === 'false') {
|
if (str === 'false') {
|
||||||
@ -108,4 +116,4 @@ module.exports = {
|
|||||||
encrypt,
|
encrypt,
|
||||||
decrypt,
|
decrypt,
|
||||||
decryptString
|
decryptString
|
||||||
};
|
};
|
||||||
|
@ -94,10 +94,10 @@ eventService.subscribe(eventService.CHILD_NOTE_CREATED, ({ parentNote, childNote
|
|||||||
function processInverseRelations(entityName, entity, handler) {
|
function processInverseRelations(entityName, entity, handler) {
|
||||||
if (entityName === 'attributes' && entity.type === 'relation') {
|
if (entityName === 'attributes' && entity.type === 'relation') {
|
||||||
const note = entity.getNote();
|
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) {
|
for (const relDefinition of relDefinitions) {
|
||||||
const definition = attribute.value;
|
const definition = relDefinition.getDefinition();
|
||||||
|
|
||||||
if (definition.inverseRelation && definition.inverseRelation.trim()) {
|
if (definition.inverseRelation && definition.inverseRelation.trim()) {
|
||||||
const targetNote = entity.getTargetNote();
|
const targetNote = entity.getTargetNote();
|
||||||
|
@ -49,10 +49,18 @@ function decryptNotes(notes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function encrypt(plainText) {
|
function encrypt(plainText) {
|
||||||
|
if (plainText === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return dataEncryptionService.encrypt(getDataKey(), plainText);
|
return dataEncryptionService.encrypt(getDataKey(), plainText);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrypt(cipherText) {
|
function decrypt(cipherText) {
|
||||||
|
if (cipherText === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return dataEncryptionService.decrypt(getDataKey(), cipherText);
|
return dataEncryptionService.decrypt(getDataKey(), cipherText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user