mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	Merge branch 'master' into dev31
This commit is contained in:
		
						commit
						05374becfd
					
				
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "trilium",
 | 
			
		||||
  "version": "0.30.3-beta",
 | 
			
		||||
  "version": "0.30.4",
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
  "name": "trilium",
 | 
			
		||||
  "productName": "Trilium Notes",
 | 
			
		||||
  "description": "Trilium Notes",
 | 
			
		||||
  "version": "0.30.3-beta",
 | 
			
		||||
  "version": "0.30.4",
 | 
			
		||||
  "license": "AGPL-3.0-only",
 | 
			
		||||
  "main": "electron.js",
 | 
			
		||||
  "bin": {
 | 
			
		||||
 | 
			
		||||
@ -106,7 +106,7 @@ class Note extends Entity {
 | 
			
		||||
 | 
			
		||||
    /** @returns {Promise} */
 | 
			
		||||
    async setJsonContent(content) {
 | 
			
		||||
        await this.setContent(JSON.stringify(content));
 | 
			
		||||
        await this.setContent(JSON.stringify(content, null, '\t'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** @returns {boolean} true if this note is the root of the note tree. Root note has "root" noteId */
 | 
			
		||||
 | 
			
		||||
@ -137,6 +137,10 @@ function linkTypeChanged() {
 | 
			
		||||
 | 
			
		||||
$linkTypes.change(linkTypeChanged);
 | 
			
		||||
 | 
			
		||||
// return back focus to note text detail after quitting add link
 | 
			
		||||
// the problem is that cursor position is reset
 | 
			
		||||
$dialog.on("hidden.bs.modal", () => noteDetailText.focus());
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
    showDialog
 | 
			
		||||
};
 | 
			
		||||
@ -9,6 +9,8 @@ async function getAndExecuteBundle(noteId, originEntity = null) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function executeBundle(bundle, originEntity) {
 | 
			
		||||
    console.log(bundle);
 | 
			
		||||
 | 
			
		||||
    const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity);
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
@ -17,7 +19,7 @@ async function executeBundle(bundle, originEntity) {
 | 
			
		||||
        }.call(apiContext));
 | 
			
		||||
    }
 | 
			
		||||
    catch (e) {
 | 
			
		||||
        infoService.showAndLogError(`Execution of script "${bundle.note.title}" (${bundle.note.noteId}) failed with error: ${e.message}`);
 | 
			
		||||
        infoService.showAndLogError(`Execution of ${bundle.noteId} failed with error: ${e.message}`);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -117,7 +117,10 @@ async function saveNote() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    note.title = $noteTitle.val();
 | 
			
		||||
    note.noteContent.content = getCurrentNoteContent(note);
 | 
			
		||||
 | 
			
		||||
    if (note.noteContent != null) { // might be null for file/image
 | 
			
		||||
        note.noteContent.content = getCurrentNoteContent(note);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // it's important to set the flag back to false immediatelly after retrieving title and content
 | 
			
		||||
    // otherwise we might overwrite another change (especially async code)
 | 
			
		||||
 | 
			
		||||
@ -911,3 +911,8 @@ a.external:after, a[href^="http://"]:after, a[href^="https://"]:after {
 | 
			
		||||
    content: "\2197";
 | 
			
		||||
    vertical-align: top;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.card {
 | 
			
		||||
    background-color: inherit !important;
 | 
			
		||||
    border-color: var(--main-border-color) !important;
 | 
			
		||||
}
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
module.exports = { buildDate:"2019-03-03T20:47:50+01:00", buildRevision: "95d8f07458853dbad08964e7ec1af1d50792b0a2" };
 | 
			
		||||
module.exports = { buildDate:"2019-03-07T22:40:05+01:00", buildRevision: "02eddc347abebce63a8882f6f83ac73655005849" };
 | 
			
		||||
 | 
			
		||||
@ -357,6 +357,13 @@ async function findLogicIssues() {
 | 
			
		||||
 | 
			
		||||
            logFix(`Removed link ${linkId} because target note ${targetNoteId} is also deleted.`);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    await findIssues(`
 | 
			
		||||
          SELECT noteId
 | 
			
		||||
          FROM notes
 | 
			
		||||
          JOIN note_contents USING(noteId)
 | 
			
		||||
          WHERE notes.isDeleted = 0 AND notes.isProtected != note_contents.isProtected`,
 | 
			
		||||
        ({noteId}) => `Note ${noteId} has inconsistent isProtected in notes and note_contents tables`);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function runSyncRowChecks(entityName, key) {
 | 
			
		||||
 | 
			
		||||
@ -116,7 +116,7 @@ async function getDateNote(dateStr) {
 | 
			
		||||
            dateNote = await createNote(monthNote.noteId, noteTitle);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        await attributeService.createLabel(dateNote.noteId, DATE_LABEL, dateStr);
 | 
			
		||||
        await attributeService.createLabel(dateNote.noteId, DATE_LABEL, dateStr.substr(0, 10));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return dateNote;
 | 
			
		||||
 | 
			
		||||
@ -332,19 +332,21 @@ async function updateNote(noteId, noteUpdates) {
 | 
			
		||||
 | 
			
		||||
    const noteTitleChanged = note.title !== noteUpdates.title;
 | 
			
		||||
 | 
			
		||||
    noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
 | 
			
		||||
 | 
			
		||||
    note.title = noteUpdates.title;
 | 
			
		||||
    note.isProtected = noteUpdates.isProtected;
 | 
			
		||||
    await note.save();
 | 
			
		||||
 | 
			
		||||
    if (note.type !== 'file' && note.type !== 'image') {
 | 
			
		||||
        const noteContent = await note.getNoteContent();
 | 
			
		||||
    const noteContent = await note.getNoteContent();
 | 
			
		||||
 | 
			
		||||
    if (!['file', 'image'].includes(note.type)) {
 | 
			
		||||
        noteUpdates.noteContent.content = await saveLinks(note, noteUpdates.noteContent.content);
 | 
			
		||||
 | 
			
		||||
        noteContent.content = noteUpdates.noteContent.content;
 | 
			
		||||
        noteContent.isProtected = noteUpdates.isProtected;
 | 
			
		||||
        await noteContent.save();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    noteContent.isProtected = noteUpdates.isProtected;
 | 
			
		||||
    await noteContent.save();
 | 
			
		||||
 | 
			
		||||
    if (noteTitleChanged) {
 | 
			
		||||
        await triggerNoteTitleChanged(note);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@ function setDataKey(decryptedDataKey) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setProtectedSessionId(req) {
 | 
			
		||||
    cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id']);
 | 
			
		||||
    cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id'] || req.query.protectedSessionId);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getProtectedSessionId() {
 | 
			
		||||
@ -62,7 +62,9 @@ function decryptNoteContent(noteContent) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
        noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content);
 | 
			
		||||
        if (noteContent.content != null) {
 | 
			
		||||
            noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    catch (e) {
 | 
			
		||||
        e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user