Component expiration handling, rename SyncAdapter -> ServerExtension
This commit is contained in:
@@ -50,11 +50,27 @@ class ComponentView {
|
||||
|
||||
if(component) {
|
||||
componentManager.activateComponent(component);
|
||||
component.runningLocally = $scope.getUrl
|
||||
console.log("Loading", $scope.component.name, $scope.getUrl());
|
||||
console.log("Loading", $scope.component.name, $scope.getUrl(), component.valid_until);
|
||||
|
||||
$scope.reloadStatus();
|
||||
}
|
||||
}
|
||||
|
||||
$scope.reloadStatus = function() {
|
||||
$scope.reloading = true;
|
||||
let previouslyValid = $scope.componentValid;
|
||||
$scope.componentValid = !$scope.component.valid_until || ($scope.component.valid_until && $scope.component.valid_until > new Date());
|
||||
if($scope.componentValid !== previouslyValid) {
|
||||
if($scope.componentValid) {
|
||||
componentManager.activateComponent($scope.component);
|
||||
}
|
||||
}
|
||||
|
||||
$timeout(() => {
|
||||
$scope.reloading = false;
|
||||
}, 500)
|
||||
}
|
||||
|
||||
$scope.getUrl = function() {
|
||||
var url = componentManager.urlForComponent($scope.component);
|
||||
$scope.component.runningLocally = url !== ($scope.component.url || $scope.component.hosted_url);
|
||||
|
||||
@@ -153,7 +153,7 @@ class GlobalExtensionsMenu {
|
||||
var type = getParameterByName("type", link);
|
||||
|
||||
if(type == "sf") {
|
||||
$scope.handleSyncAdapterLink(link, completion);
|
||||
$scope.handleServerExtensionLink(link, completion);
|
||||
} else if(type == "editor") {
|
||||
$scope.handleEditorLink(link, completion);
|
||||
} else if(link.indexOf(".css") != -1 || type == "theme") {
|
||||
@@ -174,10 +174,10 @@ class GlobalExtensionsMenu {
|
||||
packageManager.installPackage(link, completion);
|
||||
}
|
||||
|
||||
$scope.handleSyncAdapterLink = function(link, completion) {
|
||||
$scope.handleServerExtensionLink = function(link, completion) {
|
||||
var params = parametersFromURL(link);
|
||||
params["url"] = link;
|
||||
var ext = new SyncAdapter({content: params});
|
||||
var ext = new ServerExtension({content: params});
|
||||
ext.setDirty(true);
|
||||
|
||||
modelManager.addItem(ext);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class SyncAdapter extends Item {
|
||||
class ServerExtension extends Item {
|
||||
|
||||
constructor(json_obj) {
|
||||
super(json_obj);
|
||||
@@ -25,6 +25,10 @@ class Component extends Item {
|
||||
this.hosted_url = content.hosted_url;
|
||||
this.offlineOnly = content.offlineOnly;
|
||||
|
||||
if(content.valid_until) {
|
||||
this.valid_until = new Date(content.valid_until);
|
||||
}
|
||||
|
||||
this.name = content.name;
|
||||
this.autoupdateDisabled = content.autoupdateDisabled;
|
||||
|
||||
@@ -51,6 +55,7 @@ class Component extends Item {
|
||||
url: this.url,
|
||||
hosted_url: this.hosted_url,
|
||||
local_url: this.local_url,
|
||||
valid_until: this.valid_until,
|
||||
offlineOnly: this.offlineOnly,
|
||||
name: this.name,
|
||||
area: this.area,
|
||||
|
||||
@@ -217,7 +217,7 @@ class ModelManager {
|
||||
} else if(json_obj.content_type == "SN|Component") {
|
||||
item = new Component(json_obj);
|
||||
} else if(json_obj.content_type == "SF|Extension") {
|
||||
item = new SyncAdapter(json_obj);
|
||||
item = new ServerExtension(json_obj);
|
||||
} else if(json_obj.content_type == "SF|MFA") {
|
||||
item = new Mfa(json_obj);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,39 @@
|
||||
%iframe{"ng-if" => "component",
|
||||
"ng-attr-id" => "component-{{component.uuid}}",
|
||||
"ng-src" => "{{getUrl() | trusted}}", "frameBorder" => "0",
|
||||
"sandbox" => "allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms",
|
||||
"data-component-id" => "{{component.uuid}}"}
|
||||
.sn-component{"ng-if" => "!componentValid"}
|
||||
.panel.static
|
||||
.content
|
||||
%h2.title Unable to load Standard Notes Extended
|
||||
%p Your Extended subscription expired on {{component.dateToLocalizedString(component.valid_until)}}.
|
||||
%p
|
||||
Please visit
|
||||
%a{"href" => "https://dashboard.standardnotes.org", "target" => "_blank"} dashboard.standardnotes.org
|
||||
to renew your subscription, then open the "Extensions" menu via the bottom menu of the app to refresh your account data.
|
||||
Afterwards, press the button below to attempt to reload this component.
|
||||
.panel-row
|
||||
.button.info{"ng-if" => "!reloading", "ng-click" => "reloadStatus()"}
|
||||
.label Reload
|
||||
.spinner.info.small{"ng-if" => "reloading"}
|
||||
|
||||
.panel-row
|
||||
.panel-row
|
||||
.panel-column
|
||||
%p <strong>Otherwise</strong>, please follow the steps below to disable any external editors, so you can edit your note using the plain text editor instead.
|
||||
|
||||
%p
|
||||
%ol
|
||||
%li Click the "Editor" menu item above (under the note title).
|
||||
%li Select "Plain Editor".
|
||||
%li Repeat this for every note you'd like to access. You can also delete the editor completely to disable it for all notes. To do so, click "Extensions" in the lower left corner of the app, then, for every editor, click "Uninstall".
|
||||
|
||||
%p
|
||||
Need help? Please email us at
|
||||
%a{"href" => "mailto:hello@standardnotes.org", "target" => "_blank"} hello@standardnotes.org
|
||||
or check out the
|
||||
%a{"href" => "https://standardnotes.org/help", "target" => "_blank"} Help
|
||||
page.
|
||||
|
||||
%iframe{"ng-if" => "component && componentValid",
|
||||
"ng-attr-id" => "component-{{component.uuid}}",
|
||||
"ng-src" => "{{getUrl() | trusted}}", "frameBorder" => "0",
|
||||
"sandbox" => "allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms",
|
||||
"data-component-id" => "{{component.uuid}}"}
|
||||
Loading
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -5781,9 +5781,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"sn-stylekit": {
|
||||
"version": "1.0.1191",
|
||||
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-1.0.1191.tgz",
|
||||
"integrity": "sha512-Xez1FNz822zw7NsG9krfxiSXklYZQNwQRSaTbxnYXmOjqCvcsGiWAgEyUzSo5p3g2nVIC/8LzKIrQw4/b3ORXw==",
|
||||
"version": "1.0.1192",
|
||||
"resolved": "https://registry.npmjs.org/sn-stylekit/-/sn-stylekit-1.0.1192.tgz",
|
||||
"integrity": "sha512-qvR1rPI1FeG+Us2+P+0XZ0kndd5D9gg93Xla8aqopNbJ3xB2vh3OXvl/3XRSL4xKNrG+4Ub7u5Xg/J5NPPNRoA==",
|
||||
"dev": true
|
||||
},
|
||||
"snake-case": {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-jasmine": "^1.1.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"sn-stylekit": "^1.0.1191"
|
||||
"sn-stylekit": "^1.0.1192"
|
||||
},
|
||||
"license": "GPL-3.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user