diff --git a/client/src/components/NoteInputPanel.vue b/client/src/components/NoteInputPanel.vue index 32079f5..142ab51 100644 --- a/client/src/components/NoteInputPanel.vue +++ b/client/src/components/NoteInputPanel.vue @@ -59,7 +59,7 @@

- + This note is encrypted and requires a password to be opened. @@ -860,7 +860,10 @@ this.created = response.data.created this.updated = response.data.updated - this.noteTitle = response.data.title + this.noteTitle = '' + if(response.data.title){ + this.noteTitle = response.data.title + } this.noteText = response.data.text this.diffNoteText = response.data.text @@ -911,6 +914,8 @@ }, diffText(){ + return + // dont emit to one user if(this.usersOnNote <= 1){ return @@ -959,7 +964,7 @@ }, patchText(patch_text){ - console.log(patch_text) + return // // Capture x,y of caret and position into string @@ -967,10 +972,10 @@ let currentSelection = this.editor.getSelection() let lineText = currentSelection.startContainer.textContent - console.log(lineText) + // console.log(lineText) let cursorOffset = parseInt(currentSelection.startOffset) //number of characters in let path = this.xpath(currentSelection.commonAncestorContainer.parentElement) - console.log(path) + // console.log(path) // @@ -979,21 +984,21 @@ let currentText = this.editor._getHTML() const startingLines = (currentText.match(/
/g) || '').length + 1 - console.log('1') + // console.log('1') const dmp = new DiffMatchPatch.diff_match_patch() var patches = dmp.patch_fromText(patch_text); var results = dmp.patch_apply(patches, currentText); let newText = results[0] - console.log('2') + // console.log('2') this.noteText = newText this.diffNoteText = newText - console.log('3') + // console.log('3') // this.editor._setHTML(newText) this.editor.setHTML(newText) - console.log('4') + // console.log('4') // // I user hasn't selected the document, we are done here @@ -1041,14 +1046,14 @@ } } - console.log('Targeting Node') - console.log(node) + // console.log('Targeting Node') + // console.log(node) //Create and set range let squireRange = this.editor.createRange(node, cursorOffset) squireRange.collapse(true) this.editor.setSelection(squireRange) - console.log('cursor set') + // console.log('cursor set') }, 20) // } diff --git a/client/src/pages/NotesPage.vue b/client/src/pages/NotesPage.vue index 2cf4994..ed893fd 100644 --- a/client/src/pages/NotesPage.vue +++ b/client/src/pages/NotesPage.vue @@ -59,6 +59,7 @@

Notes with Tags

Archived Notes

Shared Notes

+

Password Protected Notes

@@ -184,7 +185,8 @@ 'shared': ['envelope outline', 'Received Notes'], 'sent': ['paper plane outline', 'Shared Notes'], 'notes': ['file','Notes'], - 'highlights': ['paragraph', 'Found In Text'] + 'highlights': ['paragraph', 'Found In Text'], + 'locked': ['lock', 'Password Protected'] }, noteSections: { pinned: [], @@ -193,6 +195,7 @@ sent:[], notes: [], highlights: [], + locked: [] }, } @@ -599,6 +602,10 @@ this.noteSections.sent.push(note) return } + if(note.encrypted == 1 && this.fastFilters.onlyShowEncrypted == 1){ + this.noteSections.locked.push(note) + return + } if(note.note_highlights.length > 0){ this.noteSections.highlights.push(note) return diff --git a/server/models/Note.js b/server/models/Note.js index beb596d..536f952 100644 --- a/server/models/Note.js +++ b/server/models/Note.js @@ -436,7 +436,6 @@ Note.get = (userId, noteId, password = '') => { //To many attempts in less than 5 minutes, note is locked if(noteData.decrypt_attempts_count > 3 && timeSinceLastUnlock < 300){ - console.log('Locked Out') noteLockedOut = true } @@ -444,7 +443,6 @@ Note.get = (userId, noteId, password = '') => { if(noteData.decrypt_attempts_count > 0 && timeSinceLastUnlock > 300){ noteLockedOut = false noteData.decrypt_attempts_count = 0 - console.log('Resseting Lockout') db.promise().query('UPDATE note_raw_text SET last_decrypted_date = ?, decrypt_attempts_count = 0 WHERE id = ?', [nowTime, rawTextId ]) } } @@ -628,8 +626,10 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => { searchAllNotes = true } + //Encrypted Note if(fastFilters.onlyShowEncrypted == 1){ noteSearchQuery += ' AND encrypted = 1' + searchAllNotes = true } //If tags are passed, use those tags in search diff --git a/server/models/Tag.js b/server/models/Tag.js index 5bb88d9..41877ed 100644 --- a/server/models/Tag.js +++ b/server/models/Tag.js @@ -23,6 +23,10 @@ Tag.userTags = (userId, searchQuery, searchTags, fastFilters) => { query += ' AND note.share_user_id IS NULL' } + if(fastFilters && fastFilters.onlyShowEncrypted == 1){ + query += ' AND note.encrypted = 1' //Show Archived + } + //Show archived notes, only if fast filter is set, default to not archived if(fastFilters && fastFilters.onlyArchived == 1){ query += ' AND note.archived = 1' //Show Archived