mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	note decryption
This commit is contained in:
		
							parent
							
								
									f1182c9415
								
							
						
					
					
						commit
						a760fbbf1b
					
				@ -40,7 +40,8 @@
 | 
			
		||||
 | 
			
		||||
      <div id="noteDetailWrapper" style="width: 750px; float: left; margin-left: 30px;">
 | 
			
		||||
        <div style="float: left; margin: 0 5px 5px 5px;" class="hide-toggle">
 | 
			
		||||
          <button class="btn btn-sm" onclick="encryptNoteAndSendToServer();" style="position: absolute; left: 950px;">Encrypt</button>
 | 
			
		||||
          <button class="btn btn-sm" onclick="encryptNoteAndSendToServer();" id="encryptButton">Encrypt</button>
 | 
			
		||||
          <button class="btn btn-sm" onclick="decryptNoteAndSendToServer();" id="decryptButton">Decrypt</button>
 | 
			
		||||
 | 
			
		||||
          <input autocomplete="off" value="Welcome to Notecase web app!" id="noteTitle" style="font-size: x-large; border: 0; width: 600px;" tabindex="1">
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
@ -144,9 +144,13 @@ recentNotes = [];
 | 
			
		||||
function setNoteBackgroundIfEncrypted(note) {
 | 
			
		||||
    if (note.detail.encryption > 0) {
 | 
			
		||||
        $(".note-editable").addClass("encrypted");
 | 
			
		||||
        $("#encryptButton").hide();
 | 
			
		||||
        $("#decryptButton").show();
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        $(".note-editable").removeClass("encrypted");
 | 
			
		||||
        $("#encryptButton").show();
 | 
			
		||||
        $("#decryptButton").hide();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -306,6 +310,18 @@ function encryptNoteAndSendToServer() {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function decryptNoteAndSendToServer() {
 | 
			
		||||
    const note = globalNote;
 | 
			
		||||
 | 
			
		||||
    updateNoteFromInputs(note);
 | 
			
		||||
 | 
			
		||||
    note.detail.encryption = 0;
 | 
			
		||||
 | 
			
		||||
    saveNoteToServer(note);
 | 
			
		||||
 | 
			
		||||
    setNoteBackgroundIfEncrypted(note);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function decryptNoteIfNecessary(note) {
 | 
			
		||||
    let decryptPromise;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -53,4 +53,14 @@ span.fancytree-node.fancytree-folder > span.fancytree-icon {
 | 
			
		||||
    overflow-y: auto;
 | 
			
		||||
    /* prevent horizontal scrollbar */
 | 
			
		||||
    overflow-x: hidden;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#encryptButton {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 950px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#decryptButton {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    left: 950px;
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user