添加解密失败fallback逻辑
This commit is contained in:
@@ -28,10 +28,13 @@ const key = crypto.createHash('sha256').update(location.host + '_TWS_姐姐_' +
|
|||||||
|
|
||||||
if (dataIsEmpty) localStorage.tws_data = Aes.encrypt('{}', key)
|
if (dataIsEmpty) localStorage.tws_data = Aes.encrypt('{}', key)
|
||||||
|
|
||||||
let _dec = Aes.decrypt(localStorage.tws_data, key)
|
let _data_cached
|
||||||
if (_dec == '') _dec = '{}'
|
try {
|
||||||
|
_data_cached = JSON.parse(Aes.decrypt(localStorage.tws_data, key))
|
||||||
const _data_cached = JSON.parse(_dec)
|
} catch (e) {
|
||||||
|
console.warn("数据解密失败, 使用空数据...", e)
|
||||||
|
_data_cached = {}
|
||||||
|
}
|
||||||
|
|
||||||
type IData = {
|
type IData = {
|
||||||
refresh_token?: string
|
refresh_token?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user