@etsoo/appscript 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/app/CoreApp.js +9 -4
- package/lib/mjs/app/CoreApp.js +9 -4
- package/package.json +2 -2
- package/src/app/CoreApp.ts +12 -4
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -131,20 +131,25 @@ class CoreApp {
|
|
|
131
131
|
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
132
132
|
if (passphraseDecrypted != null) {
|
|
133
133
|
this.passphrase = passphraseDecrypted;
|
|
134
|
+
// Same device
|
|
135
|
+
if (this.deviceId ===
|
|
136
|
+
this.storage.getPersistedData(CoreApp.deviceIdField)) {
|
|
137
|
+
this.storage.clear(this.persistedFields, true);
|
|
138
|
+
}
|
|
134
139
|
return false;
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
// Restore
|
|
138
|
-
this.storage.
|
|
143
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
139
144
|
return true;
|
|
140
145
|
}
|
|
141
146
|
/**
|
|
142
147
|
* Persist settings to source when application exit
|
|
143
148
|
*/
|
|
144
149
|
persist() {
|
|
145
|
-
this.
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
if (!this.authorized)
|
|
151
|
+
return;
|
|
152
|
+
this.storage.copyTo(this.persistedFields);
|
|
148
153
|
}
|
|
149
154
|
/**
|
|
150
155
|
* Setup Api
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -128,20 +128,25 @@ export class CoreApp {
|
|
|
128
128
|
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
129
129
|
if (passphraseDecrypted != null) {
|
|
130
130
|
this.passphrase = passphraseDecrypted;
|
|
131
|
+
// Same device
|
|
132
|
+
if (this.deviceId ===
|
|
133
|
+
this.storage.getPersistedData(CoreApp.deviceIdField)) {
|
|
134
|
+
this.storage.clear(this.persistedFields, true);
|
|
135
|
+
}
|
|
131
136
|
return false;
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
// Restore
|
|
135
|
-
this.storage.
|
|
140
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
136
141
|
return true;
|
|
137
142
|
}
|
|
138
143
|
/**
|
|
139
144
|
* Persist settings to source when application exit
|
|
140
145
|
*/
|
|
141
146
|
persist() {
|
|
142
|
-
this.
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
if (!this.authorized)
|
|
148
|
+
return;
|
|
149
|
+
this.storage.copyTo(this.persistedFields);
|
|
145
150
|
}
|
|
146
151
|
/**
|
|
147
152
|
* Setup Api
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@etsoo/notificationbase": "^1.0.95",
|
|
56
56
|
"@etsoo/restclient": "^1.0.63",
|
|
57
|
-
"@etsoo/shared": "^1.0.
|
|
57
|
+
"@etsoo/shared": "^1.0.94",
|
|
58
58
|
"@types/crypto-js": "^4.0.2",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
60
60
|
},
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -663,12 +663,21 @@ export abstract class CoreApp<
|
|
|
663
663
|
);
|
|
664
664
|
if (passphraseDecrypted != null) {
|
|
665
665
|
this.passphrase = passphraseDecrypted;
|
|
666
|
+
|
|
667
|
+
// Same device
|
|
668
|
+
if (
|
|
669
|
+
this.deviceId ===
|
|
670
|
+
this.storage.getPersistedData<string>(CoreApp.deviceIdField)
|
|
671
|
+
) {
|
|
672
|
+
this.storage.clear(this.persistedFields, true);
|
|
673
|
+
}
|
|
674
|
+
|
|
666
675
|
return false;
|
|
667
676
|
}
|
|
668
677
|
}
|
|
669
678
|
|
|
670
679
|
// Restore
|
|
671
|
-
this.storage.
|
|
680
|
+
this.storage.copyFrom(this.persistedFields, true);
|
|
672
681
|
|
|
673
682
|
return true;
|
|
674
683
|
}
|
|
@@ -677,9 +686,8 @@ export abstract class CoreApp<
|
|
|
677
686
|
* Persist settings to source when application exit
|
|
678
687
|
*/
|
|
679
688
|
persist() {
|
|
680
|
-
this.
|
|
681
|
-
|
|
682
|
-
});
|
|
689
|
+
if (!this.authorized) return;
|
|
690
|
+
this.storage.copyTo(this.persistedFields);
|
|
683
691
|
}
|
|
684
692
|
|
|
685
693
|
/**
|