From d4195f82042c64de11e5eec072180d4983f81ebf Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 14 Jul 2021 19:00:33 -0300 Subject: [PATCH 1/7] chore(version-snjs): 2.7.19 - permissions handling --- .env.sample | 1 + app/assets/javascripts/app.ts | 5 ++++- app/assets/javascripts/startApplication.ts | 1 + .../javascripts/ui_models/application.ts | 2 ++ app/views/application/app.html.erb | 1 + index.html | 2 ++ package.json | 2 +- yarn.lock | 18 +++++++++--------- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.env.sample b/.env.sample index c7ad4a0b3..5033e80ba 100644 --- a/.env.sample +++ b/.env.sample @@ -15,6 +15,7 @@ SF_DEFAULT_SERVER=http://localhost:3000 DEV_DEFAULT_SYNC_SERVER=https://api.standardnotes.com DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html ENABLE_UNFINISHED_FEATURES=false +DEV_WEBSOCKET_URL=wss://sockets-dev.standardnotes.com # NewRelic (Optional) NEW_RELIC_ENABLED=false diff --git a/app/assets/javascripts/app.ts b/app/assets/javascripts/app.ts index d354335b7..e7470bbe0 100644 --- a/app/assets/javascripts/app.ts +++ b/app/assets/javascripts/app.ts @@ -91,6 +91,7 @@ function reloadHiddenFirefoxTab(): boolean { const startApplication: StartApplication = async function startApplication( defaultSyncServerHost: string, bridge: Bridge, + webSocketUrl: string, ) { if (reloadHiddenFirefoxTab()) { return; @@ -107,7 +108,8 @@ const startApplication: StartApplication = async function startApplication( .config(configRoutes) .constant('bridge', bridge) .constant('defaultSyncServerHost', defaultSyncServerHost) - .constant('appVersion', bridge.appVersion); + .constant('appVersion', bridge.appVersion) + .constant('webSocketUrl', webSocketUrl); // Controllers angular @@ -193,6 +195,7 @@ if (__WEB__) { startApplication( (window as any)._default_sync_server, new BrowserBridge(__VERSION__), + (window as any)._websocket_url, ); } else { (window as any).startApplication = startApplication; diff --git a/app/assets/javascripts/startApplication.ts b/app/assets/javascripts/startApplication.ts index b7fdf2580..a3f5b1668 100644 --- a/app/assets/javascripts/startApplication.ts +++ b/app/assets/javascripts/startApplication.ts @@ -3,4 +3,5 @@ import { Bridge } from "./services/bridge"; export type StartApplication = ( defaultSyncServerHost: string, bridge: Bridge, + webSocketUrl: string, ) => Promise; diff --git a/app/assets/javascripts/ui_models/application.ts b/app/assets/javascripts/ui_models/application.ts index 2226284f9..b689433de 100644 --- a/app/assets/javascripts/ui_models/application.ts +++ b/app/assets/javascripts/ui_models/application.ts @@ -53,6 +53,7 @@ export class WebApplication extends SNApplication { scope: angular.IScope, defaultSyncServerHost: string, public bridge: Bridge, + webSocketUrl: string, ) { super( bridge.environment, @@ -63,6 +64,7 @@ export class WebApplication extends SNApplication { identifier, [], defaultSyncServerHost, + webSocketUrl, ); this.$compile = $compile; this.scope = scope; diff --git a/app/views/application/app.html.erb b/app/views/application/app.html.erb index 0cd8b0d88..2bc9dc470 100644 --- a/app/views/application/app.html.erb +++ b/app/views/application/app.html.erb @@ -34,6 +34,7 @@ window._batch_manager_location = "<%= ENV['BATCH_MANAGER_LOCATION'] %>"; window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>"; window._enable_unfinished_features = "<%= ENV['ENABLE_UNFINISHED_FEATURES'] %>" === 'true'; + window._websocket_url = "<%= ENV['WEBSOCKET_URL'] %>"; <% if Rails.env.development? %> diff --git a/index.html b/index.html index ad4ed41e8..691b2da48 100644 --- a/index.html +++ b/index.html @@ -33,12 +33,14 @@ data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>" data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>" data-enable-unfinished-features="<%= env.ENABLE_UNFINISHED_FEATURES %>" + data-web-socket-url="<%= env.DEV_WEBSOCKET_URL %>" > diff --git a/package.json b/package.json index 4da575b8b..8876baaf1 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@reach/checkbox": "^0.13.2", "@reach/dialog": "^0.13.0", "@standardnotes/sncrypto-web": "1.2.10", - "@standardnotes/snjs": "2.7.18", + "@standardnotes/snjs": "2.7.19", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index eda2a81ff..7864235cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2011,10 +2011,10 @@ prop-types "^15.7.2" tslib "^2.1.0" -"@standardnotes/auth@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@standardnotes/auth/-/auth-2.0.0.tgz#93f633fd40855f87843f911109e92b29dcbc5a04" - integrity sha512-B2NznCm3pzwBvBU/YQfuDrtlEbLO3hNH3QrqSwK2dFwUGAnl5UQPC9FKFWYgly05rWevwMY3IUmiZRzUEVlKsQ== +"@standardnotes/auth@3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@standardnotes/auth/-/auth-3.1.1.tgz#834701c2e14d31eb204bff90457fa05e9183464a" + integrity sha512-E9zDYZ1gJkVZBEzd7a1L2haQ4GYeH1lUrY87UmDH1AMYUHW+c0SqZ71af1fBNqGzrx3EZSXk+Qzr7RyOa6N1Mw== "@standardnotes/sncrypto-common@^1.2.7", "@standardnotes/sncrypto-common@^1.2.9": version "1.2.9" @@ -2029,12 +2029,12 @@ "@standardnotes/sncrypto-common" "^1.2.7" libsodium-wrappers "^0.7.8" -"@standardnotes/snjs@2.7.18": - version "2.7.18" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.18.tgz#90dd33576176da53714438e0819eef180c221381" - integrity sha512-fXv91FhsxLRMK9KR1LLNzG/k9vdnMqrqMwQrfRECDqJRG2iZvlvVqzgWKBCYtCvLRHSRnFmt0xPKA2yuTkZqpA== +"@standardnotes/snjs@2.7.19": + version "2.7.19" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.19.tgz#060d7e003e9c32e848e517c7e21b30db29a6e369" + integrity sha512-KeM6HNWjWpb4RF3QcEUqCT8m8c0LdpDO01dRSMOmz61N4L/fO0qyVj/FiDq2Tr9KSCHitWrwgX9hKhbZquvSsA== dependencies: - "@standardnotes/auth" "^2.0.0" + "@standardnotes/auth" "3.1.1" "@standardnotes/sncrypto-common" "^1.2.9" "@svgr/babel-plugin-add-jsx-attribute@^5.4.0": From f5ae75ef26853a632bb12502d06bfce82d5a821c Mon Sep 17 00:00:00 2001 From: Gorjan Petrovski Date: Thu, 15 Jul 2021 12:06:32 +0200 Subject: [PATCH 2/7] fix: provide websocket url to ApplicationGroup (#602) --- app/assets/javascripts/ui_models/application_group.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/ui_models/application_group.ts b/app/assets/javascripts/ui_models/application_group.ts index 0fd5252de..97bb016af 100644 --- a/app/assets/javascripts/ui_models/application_group.ts +++ b/app/assets/javascripts/ui_models/application_group.ts @@ -29,6 +29,7 @@ export class ApplicationGroup extends SNApplicationGroup { $timeout: ng.ITimeoutService, private defaultSyncServerHost: string, private bridge: Bridge, + private webSocketUrl: string ) { super(new WebDeviceInterface($timeout, bridge)); this.$compile = $compile; @@ -63,6 +64,7 @@ export class ApplicationGroup extends SNApplicationGroup { scope, this.defaultSyncServerHost, this.bridge, + this.webSocketUrl ); const appState = new AppState( this.$rootScope, From 08ab1d009d2ec99d763a27111eb38fd35412a249 Mon Sep 17 00:00:00 2001 From: Gorjan Petrovski Date: Thu, 15 Jul 2021 12:14:28 +0200 Subject: [PATCH 3/7] fix: creating placeholder note redirects focus (#601) --- app/assets/javascripts/views/notes/notes_view.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index 5ad8a32c8..1911fa0cf 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -255,7 +255,7 @@ class NotesViewCtrl extends PureViewCtrl { if (selectedTag.isSmartTag && !selectedTag.isAllTag) { return; } - return this.createNewNote(); + return this.createNewNote(false); } streamNotesAndTags() { @@ -354,7 +354,7 @@ class NotesViewCtrl extends PureViewCtrl { await this.appState.notes.selectNote(note.uuid, userTriggered); } - async createNewNote() { + async createNewNote(focusNewNote = true) { this.appState.notes.unselectNotes(); let title = `Note ${this.state.notes.length + 1}`; if (this.isFiltering()) { @@ -365,7 +365,9 @@ class NotesViewCtrl extends PureViewCtrl { await this.reloadNotes(); await this.appState.noteTags.reloadTags(); const noteTitleEditorElement = document.getElementById('note-title-editor'); - noteTitleEditorElement?.focus(); + if (focusNewNote) { + noteTitleEditorElement?.focus(); + } } async handleTagChange(tag: SNTag) { From ffc84a7ab66d4a4b0d18dee7d74a378d71e17910 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Thu, 15 Jul 2021 12:49:36 -0300 Subject: [PATCH 4/7] chore(version-snjs): 2.7.20 --- app/assets/javascripts/ui_models/application.ts | 2 -- app/assets/javascripts/ui_models/application_group.ts | 1 - package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/ui_models/application.ts b/app/assets/javascripts/ui_models/application.ts index b689433de..2226284f9 100644 --- a/app/assets/javascripts/ui_models/application.ts +++ b/app/assets/javascripts/ui_models/application.ts @@ -53,7 +53,6 @@ export class WebApplication extends SNApplication { scope: angular.IScope, defaultSyncServerHost: string, public bridge: Bridge, - webSocketUrl: string, ) { super( bridge.environment, @@ -64,7 +63,6 @@ export class WebApplication extends SNApplication { identifier, [], defaultSyncServerHost, - webSocketUrl, ); this.$compile = $compile; this.scope = scope; diff --git a/app/assets/javascripts/ui_models/application_group.ts b/app/assets/javascripts/ui_models/application_group.ts index 97bb016af..795e7530a 100644 --- a/app/assets/javascripts/ui_models/application_group.ts +++ b/app/assets/javascripts/ui_models/application_group.ts @@ -64,7 +64,6 @@ export class ApplicationGroup extends SNApplicationGroup { scope, this.defaultSyncServerHost, this.bridge, - this.webSocketUrl ); const appState = new AppState( this.$rootScope, diff --git a/package.json b/package.json index 8876baaf1..0d1a2394b 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@reach/checkbox": "^0.13.2", "@reach/dialog": "^0.13.0", "@standardnotes/sncrypto-web": "1.2.10", - "@standardnotes/snjs": "2.7.19", + "@standardnotes/snjs": "2.7.20", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index 7864235cd..80187165b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2029,10 +2029,10 @@ "@standardnotes/sncrypto-common" "^1.2.7" libsodium-wrappers "^0.7.8" -"@standardnotes/snjs@2.7.19": - version "2.7.19" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.19.tgz#060d7e003e9c32e848e517c7e21b30db29a6e369" - integrity sha512-KeM6HNWjWpb4RF3QcEUqCT8m8c0LdpDO01dRSMOmz61N4L/fO0qyVj/FiDq2Tr9KSCHitWrwgX9hKhbZquvSsA== +"@standardnotes/snjs@2.7.20": + version "2.7.20" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.20.tgz#73b5a6c3d5c05a575ee7b5bcf082af42cb172860" + integrity sha512-EoxIc6wWn9kHMcDE9M1hSXozq4r2dGjdUVY7zAOdTGgnuWPrUMOgVZNEXbF6C0jI3cGO/jNmtQ64fikcqwSwpw== dependencies: "@standardnotes/auth" "3.1.1" "@standardnotes/sncrypto-common" "^1.2.9" From 0b8cd1b7b4eaa17634a97d4eb5c0e535096b68ce Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 19 Jul 2021 12:15:35 -0300 Subject: [PATCH 5/7] fix: avoid changing selected note when editing archived or trashed note from search results --- app/assets/javascripts/ui_models/app_state/app_state.ts | 7 ++++++- app/assets/javascripts/views/notes/notes_view.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/ui_models/app_state/app_state.ts b/app/assets/javascripts/ui_models/app_state/app_state.ts index 04fa7ff4b..0a897f55a 100644 --- a/app/assets/javascripts/ui_models/app_state/app_state.ts +++ b/app/assets/javascripts/ui_models/app_state/app_state.ts @@ -246,11 +246,16 @@ export class AppState { } if (note.deleted) { this.closeEditor(editor); - } else if (note.trashed && !this.selectedTag?.isTrashTag) { + } else if ( + note.trashed && + !this.selectedTag?.isTrashTag && + !this.searchOptions.includeTrashed + ) { this.closeEditor(editor); } else if ( note.archived && !this.selectedTag?.isArchiveTag && + !this.searchOptions.includeArchived && !this.application.getPreference(PrefKey.NotesShowArchived, false) ) { this.closeEditor(editor); diff --git a/app/assets/javascripts/views/notes/notes_view.ts b/app/assets/javascripts/views/notes/notes_view.ts index 1911fa0cf..f1babb53b 100644 --- a/app/assets/javascripts/views/notes/notes_view.ts +++ b/app/assets/javascripts/views/notes/notes_view.ts @@ -277,7 +277,11 @@ class NotesViewCtrl extends PureViewCtrl { if (this.application.getAppState().notes.selectedNotesCount < 2) { if (activeNote) { const discarded = activeNote.deleted || activeNote.trashed; - if (discarded && !this.appState?.selectedTag?.isTrashTag) { + if ( + discarded && + !this.appState?.selectedTag?.isTrashTag && + !this.appState?.searchOptions.includeTrashed + ) { this.selectNextOrCreateNew(); } else if (!this.state.selectedNotes[activeNote.uuid]) { this.selectNote(activeNote); From bffd9ec54d6f105050cfb05d94a4d630c8a79f7c Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 20 Jul 2021 15:54:57 -0300 Subject: [PATCH 6/7] chore(version-snjs): 2.7.21 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 0d1a2394b..e1882c820 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@reach/checkbox": "^0.13.2", "@reach/dialog": "^0.13.0", "@standardnotes/sncrypto-web": "1.2.10", - "@standardnotes/snjs": "2.7.20", + "@standardnotes/snjs": "2.7.21", "mobx": "^6.1.6", "mobx-react-lite": "^3.2.0", "preact": "^10.5.12" diff --git a/yarn.lock b/yarn.lock index 80187165b..bf79c098b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2029,10 +2029,10 @@ "@standardnotes/sncrypto-common" "^1.2.7" libsodium-wrappers "^0.7.8" -"@standardnotes/snjs@2.7.20": - version "2.7.20" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.20.tgz#73b5a6c3d5c05a575ee7b5bcf082af42cb172860" - integrity sha512-EoxIc6wWn9kHMcDE9M1hSXozq4r2dGjdUVY7zAOdTGgnuWPrUMOgVZNEXbF6C0jI3cGO/jNmtQ64fikcqwSwpw== +"@standardnotes/snjs@2.7.21": + version "2.7.21" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.21.tgz#db451e5facaf5fa41fa509eb1f304723929c3541" + integrity sha512-GhkGk1LJmD494COZkSOgyHaUnGnLWNLlSuCZMTwbw3dgkN5PjobbRhfDvEZaLqjwok+h9nkiQt3hugQ3h6Cy5w== dependencies: "@standardnotes/auth" "3.1.1" "@standardnotes/sncrypto-common" "^1.2.9" From 660a58ef1943ee6b10b47609d61828f2a2fcf5ba Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 21 Jul 2021 17:08:14 -0300 Subject: [PATCH 7/7] chore(version): 3.8.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e1882c820..6c9f8762d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "standard-notes-web", - "version": "3.8.17", + "version": "3.8.18", "license": "AGPL-3.0-or-later", "repository": { "type": "git",