From d4195f82042c64de11e5eec072180d4983f81ebf Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 14 Jul 2021 19:00:33 -0300 Subject: [PATCH] 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":