@onyx-p/imlib-web 1.9.5 → 1.9.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/index.esm.js CHANGED
@@ -7794,7 +7794,14 @@ const LocalStorageService = {
7794
7794
  };
7795
7795
  const SecureStorageService = {
7796
7796
  get: function (key) {
7797
- let value = localStorage.getItem(key);
7797
+ let value;
7798
+ if (isElectron() && electronStore) {
7799
+ value = electronStore.get(key);
7800
+ } else if (typeof localStorage !== 'undefined') {
7801
+ value = localStorage.getItem(key);
7802
+ } else {
7803
+ return null;
7804
+ }
7798
7805
  if (isDef(value)) {
7799
7806
  const encryptedHexStr = CryptoJS.enc.Hex.parse(value);
7800
7807
  const srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
@@ -7814,18 +7821,26 @@ const SecureStorageService = {
7814
7821
  }
7815
7822
  },
7816
7823
  set: function (key, value) {
7817
- if (isDef(value)) {
7818
- const encryptedData = CryptoJS.AES.encrypt(JSON.stringify(value), AesKey, {
7819
- iv: AesIv
7820
- });
7821
- const encrytedStr = encryptedData.ciphertext.toString();
7822
- localStorage.setItem(key, encrytedStr);
7823
- } else {
7824
+ if (!isDef(value)) {
7824
7825
  this.remove(key);
7826
+ return;
7827
+ }
7828
+ const encryptedData = CryptoJS.AES.encrypt(JSON.stringify(value), AesKey, {
7829
+ iv: AesIv
7830
+ });
7831
+ const encrytedStr = encryptedData.ciphertext.toString();
7832
+ if (isElectron() && electronStore) {
7833
+ electronStore.set(key, encrytedStr);
7834
+ } else if (typeof localStorage !== 'undefined') {
7835
+ localStorage.setItem(key, encrytedStr);
7825
7836
  }
7826
7837
  },
7827
7838
  remove: function (key) {
7828
- localStorage.removeItem(key);
7839
+ if (isElectron() && electronStore) {
7840
+ electronStore.delete(key);
7841
+ } else if (typeof localStorage !== 'undefined') {
7842
+ localStorage.removeItem(key);
7843
+ }
7829
7844
  }
7830
7845
  };
7831
7846
  const STORAGE_ROOT_KEY = 'ACIM-';
package/index.umd.js CHANGED
@@ -7800,7 +7800,14 @@
7800
7800
  };
7801
7801
  const SecureStorageService = {
7802
7802
  get: function (key) {
7803
- let value = localStorage.getItem(key);
7803
+ let value;
7804
+ if (isElectron() && electronStore) {
7805
+ value = electronStore.get(key);
7806
+ } else if (typeof localStorage !== 'undefined') {
7807
+ value = localStorage.getItem(key);
7808
+ } else {
7809
+ return null;
7810
+ }
7804
7811
  if (isDef(value)) {
7805
7812
  const encryptedHexStr = CryptoJS.enc.Hex.parse(value);
7806
7813
  const srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
@@ -7820,18 +7827,26 @@
7820
7827
  }
7821
7828
  },
7822
7829
  set: function (key, value) {
7823
- if (isDef(value)) {
7824
- const encryptedData = CryptoJS.AES.encrypt(JSON.stringify(value), AesKey, {
7825
- iv: AesIv
7826
- });
7827
- const encrytedStr = encryptedData.ciphertext.toString();
7828
- localStorage.setItem(key, encrytedStr);
7829
- } else {
7830
+ if (!isDef(value)) {
7830
7831
  this.remove(key);
7832
+ return;
7833
+ }
7834
+ const encryptedData = CryptoJS.AES.encrypt(JSON.stringify(value), AesKey, {
7835
+ iv: AesIv
7836
+ });
7837
+ const encrytedStr = encryptedData.ciphertext.toString();
7838
+ if (isElectron() && electronStore) {
7839
+ electronStore.set(key, encrytedStr);
7840
+ } else if (typeof localStorage !== 'undefined') {
7841
+ localStorage.setItem(key, encrytedStr);
7831
7842
  }
7832
7843
  },
7833
7844
  remove: function (key) {
7834
- localStorage.removeItem(key);
7845
+ if (isElectron() && electronStore) {
7846
+ electronStore.delete(key);
7847
+ } else if (typeof localStorage !== 'undefined') {
7848
+ localStorage.removeItem(key);
7849
+ }
7835
7850
  }
7836
7851
  };
7837
7852
  const STORAGE_ROOT_KEY = 'ACIM-';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",