@etsoo/appscript 1.2.4 → 1.2.6
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 +7 -3
- package/lib/mjs/app/CoreApp.js +7 -3
- package/package.json +1 -1
- package/src/app/CoreApp.ts +13 -3
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -118,12 +118,13 @@ class CoreApp {
|
|
|
118
118
|
get persistedFields() {
|
|
119
119
|
return [
|
|
120
120
|
CoreApp.deviceIdField,
|
|
121
|
+
CoreApp.devicePassphraseField,
|
|
121
122
|
CoreApp.serversideDeviceIdField,
|
|
122
123
|
CoreApp.headerTokenField
|
|
123
124
|
];
|
|
124
125
|
}
|
|
125
126
|
getDeviceId() {
|
|
126
|
-
return this.deviceId.substring(0,
|
|
127
|
+
return this.deviceId.substring(0, 15);
|
|
127
128
|
}
|
|
128
129
|
/**
|
|
129
130
|
* Restore settings from persisted source
|
|
@@ -132,14 +133,17 @@ class CoreApp {
|
|
|
132
133
|
// Current device id, '' means new, or reload (not included) or duplicate (included)
|
|
133
134
|
if (this.deviceId) {
|
|
134
135
|
// Devices
|
|
135
|
-
const devices = this.storage.getPersistedData(CoreApp.devicesField);
|
|
136
|
+
const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
|
|
136
137
|
// Exists in the list?
|
|
137
|
-
|
|
138
|
+
const d = this.getDeviceId();
|
|
139
|
+
if (!devices.includes(d)) {
|
|
138
140
|
const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
|
|
139
141
|
if (passphraseEncrypted) {
|
|
140
142
|
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
141
143
|
if (passphraseDecrypted != null) {
|
|
142
144
|
this.passphrase = passphraseDecrypted;
|
|
145
|
+
devices.push(d);
|
|
146
|
+
this.storage.setPersistedData(CoreApp.devicesField, devices);
|
|
143
147
|
return false;
|
|
144
148
|
}
|
|
145
149
|
}
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -115,12 +115,13 @@ export class CoreApp {
|
|
|
115
115
|
get persistedFields() {
|
|
116
116
|
return [
|
|
117
117
|
CoreApp.deviceIdField,
|
|
118
|
+
CoreApp.devicePassphraseField,
|
|
118
119
|
CoreApp.serversideDeviceIdField,
|
|
119
120
|
CoreApp.headerTokenField
|
|
120
121
|
];
|
|
121
122
|
}
|
|
122
123
|
getDeviceId() {
|
|
123
|
-
return this.deviceId.substring(0,
|
|
124
|
+
return this.deviceId.substring(0, 15);
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
126
127
|
* Restore settings from persisted source
|
|
@@ -129,14 +130,17 @@ export class CoreApp {
|
|
|
129
130
|
// Current device id, '' means new, or reload (not included) or duplicate (included)
|
|
130
131
|
if (this.deviceId) {
|
|
131
132
|
// Devices
|
|
132
|
-
const devices = this.storage.getPersistedData(CoreApp.devicesField);
|
|
133
|
+
const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
|
|
133
134
|
// Exists in the list?
|
|
134
|
-
|
|
135
|
+
const d = this.getDeviceId();
|
|
136
|
+
if (!devices.includes(d)) {
|
|
135
137
|
const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
|
|
136
138
|
if (passphraseEncrypted) {
|
|
137
139
|
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
138
140
|
if (passphraseDecrypted != null) {
|
|
139
141
|
this.passphrase = passphraseDecrypted;
|
|
142
|
+
devices.push(d);
|
|
143
|
+
this.storage.setPersistedData(CoreApp.devicesField, devices);
|
|
140
144
|
return false;
|
|
141
145
|
}
|
|
142
146
|
}
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -606,6 +606,7 @@ export abstract class CoreApp<
|
|
|
606
606
|
protected get persistedFields() {
|
|
607
607
|
return [
|
|
608
608
|
CoreApp.deviceIdField,
|
|
609
|
+
CoreApp.devicePassphraseField,
|
|
609
610
|
CoreApp.serversideDeviceIdField,
|
|
610
611
|
CoreApp.headerTokenField
|
|
611
612
|
];
|
|
@@ -650,7 +651,7 @@ export abstract class CoreApp<
|
|
|
650
651
|
}
|
|
651
652
|
|
|
652
653
|
private getDeviceId() {
|
|
653
|
-
return this.deviceId.substring(0,
|
|
654
|
+
return this.deviceId.substring(0, 15);
|
|
654
655
|
}
|
|
655
656
|
|
|
656
657
|
/**
|
|
@@ -661,11 +662,13 @@ export abstract class CoreApp<
|
|
|
661
662
|
if (this.deviceId) {
|
|
662
663
|
// Devices
|
|
663
664
|
const devices = this.storage.getPersistedData<string[]>(
|
|
664
|
-
CoreApp.devicesField
|
|
665
|
+
CoreApp.devicesField,
|
|
666
|
+
[]
|
|
665
667
|
);
|
|
666
668
|
|
|
667
669
|
// Exists in the list?
|
|
668
|
-
|
|
670
|
+
const d = this.getDeviceId();
|
|
671
|
+
if (!devices.includes(d)) {
|
|
669
672
|
const passphraseEncrypted = this.storage.getData<string>(
|
|
670
673
|
CoreApp.devicePassphraseField
|
|
671
674
|
);
|
|
@@ -676,6 +679,13 @@ export abstract class CoreApp<
|
|
|
676
679
|
);
|
|
677
680
|
if (passphraseDecrypted != null) {
|
|
678
681
|
this.passphrase = passphraseDecrypted;
|
|
682
|
+
|
|
683
|
+
devices.push(d);
|
|
684
|
+
this.storage.setPersistedData(
|
|
685
|
+
CoreApp.devicesField,
|
|
686
|
+
devices
|
|
687
|
+
);
|
|
688
|
+
|
|
679
689
|
return false;
|
|
680
690
|
}
|
|
681
691
|
}
|