Merge branch 'develop' into feature/autocomplete-tags

This commit is contained in:
Antonella Sgarlatta
2021-06-07 14:36:29 -03:00
9 changed files with 32 additions and 7 deletions

View File

@@ -11,9 +11,11 @@ APP_HOST=http://localhost:3001
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html
SF_DEFAULT_SERVER=http://localhost:3000
SF_NEXT_VERSION_SERVER=http://localhost:3000
# Development options
DEV_DEFAULT_SYNC_SERVER=https://sync.standardnotes.org
DEV_NEXT_VERSION_SYNC_SERVER=https://api.standardnotes.com
DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html
DEV_BATCH_MANAGER_LOCATION=public/extensions/batch-manager/dist/index.min.html

View File

@@ -108,10 +108,13 @@ The web app makes use of two optional native extensions, which, when running the
BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html
```
You can also set the `SF_DEFAULT_SERVER` environment variable to set the default server for login and registration.
You can also set the `SF_DEFAULT_SERVER` and `SF_NEXT_VERSION_SERVER` environment variables to set the default servers for login and registration.
> **Note:** SF_NEXT_VERSION_SERVER can point to the same server. It is used for gradual upgrade of API versions.
```
SF_DEFAULT_SERVER=https://sync.myserver
SF_NEXT_VERSION_SERVER=https://sync.myserver
```
---

View File

@@ -89,7 +89,8 @@ function reloadHiddenFirefoxTab(): boolean {
const startApplication: StartApplication = async function startApplication(
defaultSyncServerHost: string,
bridge: Bridge
bridge: Bridge,
nextVersionSyncServerHost: string,
) {
if (reloadHiddenFirefoxTab()) {
return;
@@ -106,6 +107,7 @@ const startApplication: StartApplication = async function startApplication(
.config(configRoutes)
.constant('bridge', bridge)
.constant('defaultSyncServerHost', defaultSyncServerHost)
.constant('nextVersionSyncServerHost', nextVersionSyncServerHost)
.constant('appVersion', bridge.appVersion);
// Controllers
@@ -188,7 +190,8 @@ const startApplication: StartApplication = async function startApplication(
if (__WEB__) {
startApplication(
(window as any)._default_sync_server,
new BrowserBridge(__VERSION__)
new BrowserBridge(__VERSION__),
(window as any)._next_version_sync_server
);
} else {
(window as any).startApplication = startApplication;

View File

@@ -2,5 +2,6 @@ import { Bridge } from "./services/bridge";
export type StartApplication = (
defaultSyncServerHost: string,
bridge: Bridge
bridge: Bridge,
nextVersionSyncServerHost: string
) => Promise<void>;

View File

@@ -53,6 +53,7 @@ export class WebApplication extends SNApplication {
scope: angular.IScope,
defaultSyncServerHost: string,
public bridge: Bridge,
nextVersionSyncServerHost: string,
) {
super(
bridge.environment,
@@ -62,7 +63,8 @@ export class WebApplication extends SNApplication {
new AlertService(),
identifier,
[],
defaultSyncServerHost
defaultSyncServerHost,
nextVersionSyncServerHost,
);
this.$compile = $compile;
this.scope = scope;

View File

@@ -28,7 +28,8 @@ export class ApplicationGroup extends SNApplicationGroup {
$rootScope: ng.IRootScopeService,
$timeout: ng.ITimeoutService,
private defaultSyncServerHost: string,
private bridge: Bridge
private bridge: Bridge,
private nextVersionSyncServerHost: string,
) {
super(new WebDeviceInterface($timeout, bridge));
this.$compile = $compile;
@@ -62,7 +63,8 @@ export class ApplicationGroup extends SNApplicationGroup {
this.$compile,
scope,
this.defaultSyncServerHost,
this.bridge
this.bridge,
this.nextVersionSyncServerHost,
);
const appState = new AppState(
this.$rootScope,

View File

@@ -30,6 +30,7 @@
<script>
window._default_sync_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
window._next_version_sync_server = "<%= ENV['SF_NEXT_VERSION_SERVER'] %>";
window._extensions_manager_location = "<%= ENV['EXTENSIONS_MANAGER_LOCATION'] %>";
window._batch_manager_location = "<%= ENV['BATCH_MANAGER_LOCATION'] %>";
window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>";

View File

@@ -0,0 +1,9 @@
# fix for JSON deprecation warnings. See: https://github.com/flori/json/issues/399#issuecomment-734863279
module JSON
module_function
def parse(source, opts = {})
Parser.new(source, **opts).parse
end
end

View File

@@ -30,12 +30,14 @@
<body
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
data-next-version-sync-server="<%= env.DEV_NEXT_VERSION_SYNC_SERVER %>"
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
data-batch-manager-location="<%= env.DEV_BATCH_MANAGER_LOCATION %>"
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
>
<script>
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://sync.standardnotes.org";
window._next_version_sync_server = document.body.dataset.nextVersionSyncServer || "https://api.standardnotes.com";
window._extensions_manager_location = document.body.dataset.extensionsManagerLocation || "public/extensions/extensions-manager/dist/index.html";
window._batch_manager_location = document.body.dataset.batchManagerLocation || "public/extensions/batch-manager/dist/index.min.html";
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;