From 2b8f70b5fa5e497034e724d8b3184375b1cf9b7f Mon Sep 17 00:00:00 2001 From: Max G Date: Tue, 14 Apr 2020 05:09:19 +0000 Subject: [PATCH] * Added error display to every axios server call * Added better destroy of login token if invalid * Block users from opening notes they don't own, note closes automatically * Beefed up login and home page a little to make them more appealing --- .../src/components/AttachmentDisplayCard.vue | 2 + client/src/components/FileUploadButton.vue | 1 + client/src/components/GlobalSiteMenu.vue | 3 +- .../components/NoteDeleteButtonComponent.vue | 1 + client/src/components/NoteInputPanel.vue | 19 ++++++++- client/src/components/NoteTagEdit.vue | 5 +++ .../src/components/NoteTitleDisplayCard.vue | 2 + client/src/components/ShareNoteComponent.vue | 3 ++ .../SimpleAttachmentNoteComponent.vue | 1 + client/src/pages/AttachmentsPage.vue | 1 + client/src/pages/HelpPage.vue | 2 +- client/src/pages/HomePage.vue | 41 +++++++++++++------ client/src/pages/LoginPage.vue | 25 ++++++++--- client/src/pages/NotesPage.vue | 12 ++++++ client/src/pages/QuickPage.vue | 2 + client/src/pages/SharePage.vue | 1 + client/src/stores/mainStore.js | 6 ++- server/index.js | 3 +- server/models/Note.js | 7 ++++ 19 files changed, 114 insertions(+), 23 deletions(-) diff --git a/client/src/components/AttachmentDisplayCard.vue b/client/src/components/AttachmentDisplayCard.vue index 3805ac7..498beea 100644 --- a/client/src/components/AttachmentDisplayCard.vue +++ b/client/src/components/AttachmentDisplayCard.vue @@ -203,6 +203,7 @@ }, 600) } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to delete attachment') }) }, saveIt(){ @@ -221,6 +222,7 @@ //Save it, and don't think about it. axios.post('/api/attachment/update', data) + .catch(error => { this.$bus.$emit('notification', 'Failed to Save') }) }, } diff --git a/client/src/components/FileUploadButton.vue b/client/src/components/FileUploadButton.vue index c86a2f8..2021798 100644 --- a/client/src/components/FileUploadButton.vue +++ b/client/src/components/FileUploadButton.vue @@ -73,6 +73,7 @@ }) .catch(results => { this.uploadStatusText = 0 + this.$bus.$emit('notification', 'Failed to Upload') }) }, handleFileUpload() { diff --git a/client/src/components/GlobalSiteMenu.vue b/client/src/components/GlobalSiteMenu.vue index f3ee6be..2162217 100644 --- a/client/src/components/GlobalSiteMenu.vue +++ b/client/src/components/GlobalSiteMenu.vue @@ -257,7 +257,7 @@ }, data: function(){ return { - version: '1.0.2', + version: '1.0.3', username: '', collapsed: false, mobile: false, @@ -334,6 +334,7 @@ this.disableNewNote = false } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to create note') }) }, destroyLoginToken() { this.$bus.$emit('notification', 'Logged Out') diff --git a/client/src/components/NoteDeleteButtonComponent.vue b/client/src/components/NoteDeleteButtonComponent.vue index 66af2ba..c8d401d 100644 --- a/client/src/components/NoteDeleteButtonComponent.vue +++ b/client/src/components/NoteDeleteButtonComponent.vue @@ -33,6 +33,7 @@ this.$store.dispatch('fetchAndUpdateUserTotals') } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Delete Note') }) }, reset(){ this.click = 0 diff --git a/client/src/components/NoteInputPanel.vue b/client/src/components/NoteInputPanel.vue index e4fea23..d9a88d6 100644 --- a/client/src/components/NoteInputPanel.vue +++ b/client/src/components/NoteInputPanel.vue @@ -862,6 +862,13 @@ axios.post('/api/note/get', { 'noteId': this.noteid, 'password':this.hashedPass }) .then(response => { + //Block notes you don't have access to from opening + if(response.data === false){ + this.$bus.$emit('notification', 'Invalid Note') + this.close(true) + return + } + //Set up local data this.currentNoteId = this.noteid this.rawTextId = response.data.rawTextId @@ -918,6 +925,7 @@ }) }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Open Note') }) } else { console.log('Could not fetch note') } @@ -1155,6 +1163,7 @@ this.startAutolockTimer() return resolve(true) }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Save Note') }) }) }, checkForUpdatedNote(){ @@ -1183,6 +1192,7 @@ this.updated = data.updated } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to get diff') }) } //Track visibility state @@ -1208,7 +1218,14 @@ return hash; }, - close(){ + close(force = false){ + + if(force){ + this.$bus.$emit('close_active_note', { + position: this.position, noteId: this.noteid, modified: this.modified + }) + return + } this.save().then( result => { diff --git a/client/src/components/NoteTagEdit.vue b/client/src/components/NoteTagEdit.vue index 07b0ea5..9e3d8fc 100644 --- a/client/src/components/NoteTagEdit.vue +++ b/client/src/components/NoteTagEdit.vue @@ -91,6 +91,7 @@ this.allTags = data.allTags this.noteTagIds = data.noteTagIds }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Get Tags') }) }, isTagOnNote(id){ for (let i = 0; i < this.noteTagIds.length; i++) { @@ -170,6 +171,7 @@ vm.suggestions = response.data vm.selection = -1 //Nothing selected }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Get Suggested Tags') }) } }, 300) }, @@ -226,6 +228,7 @@ //Trigger focus event to reload tag suggestions vm.onFocus() }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Add Tag') }) }, onFocus(){ return @@ -240,6 +243,7 @@ vm.suggestions = response.data vm.selection = -1 //Nothing selected }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Fetch Latest Tags') }) }, onKeyup(){ @@ -268,6 +272,7 @@ .then(response => { this.getTags() }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Remove Tag') }) }, clearSuggestions(){ this.suggestions = [] diff --git a/client/src/components/NoteTitleDisplayCard.vue b/client/src/components/NoteTitleDisplayCard.vue index 874d7e4..e730cf3 100644 --- a/client/src/components/NoteTitleDisplayCard.vue +++ b/client/src/components/NoteTitleDisplayCard.vue @@ -172,6 +172,7 @@ .then(data => { this.$bus.$emit('update_single_note', this.note.id) }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Pin Note') }) }, archiveNote(){ //toggleArchived() <- old name let postData = {'archived': !this.note.archived, 'noteId':this.note.id} @@ -187,6 +188,7 @@ this.$bus.$emit('update_single_note', this.note.id) }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Archive Note') }) }, toggleTags(state){ diff --git a/client/src/components/ShareNoteComponent.vue b/client/src/components/ShareNoteComponent.vue index 292ff3d..963699b 100644 --- a/client/src/components/ShareNoteComponent.vue +++ b/client/src/components/ShareNoteComponent.vue @@ -78,6 +78,7 @@ .then( ({data}) => { this.sharedWithUsers = data }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Load Shared') }) }, onRevokeAccess(noteId){ axios.post('/api/note/shareremoveuser', {'noteId':noteId}) @@ -87,6 +88,7 @@ this.loadShareList() } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Remove Share User') }) }, onKeyup(event){ if(event.keyCode == 13){ @@ -105,6 +107,7 @@ this.$bus.$emit('notification', 'User not found') } }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Add User') }) }, } diff --git a/client/src/components/SimpleAttachmentNoteComponent.vue b/client/src/components/SimpleAttachmentNoteComponent.vue index e4d9a21..6205e05 100644 --- a/client/src/components/SimpleAttachmentNoteComponent.vue +++ b/client/src/components/SimpleAttachmentNoteComponent.vue @@ -100,6 +100,7 @@ } }) }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Load Attachments') }) }, methods: { onFileClick(file){ diff --git a/client/src/pages/AttachmentsPage.vue b/client/src/pages/AttachmentsPage.vue index 371740d..2a4de13 100644 --- a/client/src/pages/AttachmentsPage.vue +++ b/client/src/pages/AttachmentsPage.vue @@ -194,6 +194,7 @@ //Grab the next batch this.loadedAttachmentsOffset += results.data.length }) + .catch(error => { this.$bus.$emit('notification', 'Failed to Search Attachments') }) }, } } diff --git a/client/src/pages/HelpPage.vue b/client/src/pages/HelpPage.vue index 2b27ba1..185f7ca 100644 --- a/client/src/pages/HelpPage.vue +++ b/client/src/pages/HelpPage.vue @@ -11,7 +11,7 @@ -

Quick Note

The Quick note feature was designed to allow rapid input to a single note. Rather than junking up all your notes with random links, numbers or haikus, you can put them all in one place.

All data pushed to the quick note can still be edited like a normal note.


Dark Theme

Dark theme was designed to minimize the amount of blue. Less blue entering your eyes is supposed to help you fall asleep.

Most things turn sepia and a filter is applied to images to make them more sepia.

Here is some good research on the topic: https://justgetflux.com/research.html


Password Protected Notes

Note protected with a password are encrypted. This means the data is scrambled and unreadable unless the correct password is used to decrypt them.

If a password is forgotten, it can never be recovered. Passwords are not saved for encrypted notes. If you lose the password to a protected note, that note text is lost.

Only the text of the note is protected. Tags, Files attached to the note, and the title of the note are still visible without a password. You can not search text in a password protected note. But you can search by the title.


Links in notes

Links put into notes are automatically scraped. This means the data from the link will be scanned to get an image and some text from the website to help make that link more accessible in the future.


Files in notes

Files can be uploaded to notes. If its an image, the picture will be put into the note.

Images added to notes will have the text pulled out so it can be searched (This isn't super accurate so don't rely to heavily on it.) The text can be updated at any time.


Deleting notes

When notes are deleted, none of the files related to the note are deleted.


Daily Backups

All notes are backed up, every night, at midnight. If there is data loss, it can be restored from a backup. If you experience some sort of cataclysmic data loss please contact the system administrator for a copy of your data or restoration a restoration procedure.

+

Quick Note

The Quick note feature was designed to allow rapid input to a single note. Rather than junking up all your notes with random links, numbers or haikus, you can put them all in one place.

All data pushed to the quick note can still be edited like a normal note.


Dark Theme

Dark theme was designed to minimize the amount of blue. Less blue entering your eyes is supposed to help you fall asleep.

Most things turn sepia and a filter is applied to images to make them more sepia.

Here is some good research on the topic: https://justgetflux.com/research.html


Password Protected Notes

Note protected with a password are encrypted. This means the data is scrambled and unreadable unless the correct password is used to decrypt them.

If a password is forgotten, it can never be recovered. Passwords are not saved for encrypted notes. If you lose the password to a protected note, that note text is lost.

Only the text of the note is protected. Tags, Files attached to the note, and the title of the note are still visible without a password. You can not search text in a password protected note. But you can search by the title.


Links in notes

Links put into notes are automatically scraped. This means the data from the link will be scanned to get an image and some text from the website to help make that link more accessible in the future.


Files in notes

Files can be uploaded to notes. If its an image, the picture will be put into the note.

Images added to notes will have the text pulled out so it can be searched (This isn't super accurate so don't rely to heavily on it.) The text can be updated at any time.


Deleting notes

When notes are deleted, none of the files related to the note are deleted.


Daily Backups

All notes are backed up, every night, at midnight. If there is data loss, it can be restored from a backup. If you experience some sort of cataclysmic data loss please contact the system administrator for a copy of your data or a restoration procedure.

diff --git a/client/src/pages/HomePage.vue b/client/src/pages/HomePage.vue index 15b072f..b0aca90 100644 --- a/client/src/pages/HomePage.vue +++ b/client/src/pages/HomePage.vue @@ -13,6 +13,7 @@ } .logo-display { width: 50%; + max-width: 450px; } .lightly-padded { margin-top: 10px; @@ -75,10 +76,14 @@ margin-left: 0 !important; } + .home-main img { + max-height: 400px !important; + } +