修复v1.14.0出现的备份与恢复功能备份的数据无法恢复的问题
parent
e12f95ff74
commit
eb67d67a60
|
@ -1,3 +1,4 @@
|
|||
### 修复
|
||||
|
||||
- 修复我的列表搜索无法搜索小括号、中括号等字符的问题
|
||||
- 修复v1.14.0出现的备份与恢复功能备份的数据无法恢复的问题,同时兼容使用v1.14.0导出的存在问题的数据
|
||||
|
|
|
@ -464,7 +464,18 @@ export const readLxConfigFile = async path => {
|
|||
let data = await fs.promises.readFile(path, isJSON ? 'utf8' : 'binary')
|
||||
if (!data || isJSON) return data
|
||||
data = await gunzipData(Buffer.from(data, 'binary'))
|
||||
return data.toString('utf8')
|
||||
data = JSON.parse(data.toString('utf8'))
|
||||
|
||||
// 修复v1.14.0出现的导出数据被序列化两次的问题
|
||||
if (typeof data != 'object') {
|
||||
try {
|
||||
data = JSON.parse(data)
|
||||
} catch (err) {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1050,7 +1050,7 @@ export default {
|
|||
if (result.canceled) return
|
||||
let listData
|
||||
try {
|
||||
listData = JSON.parse(await readLxConfigFile(result.filePaths[0]))
|
||||
listData = await readLxConfigFile(result.filePaths[0])
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -815,7 +815,7 @@ export default {
|
|||
async importSetting(path) {
|
||||
let settingData
|
||||
try {
|
||||
settingData = JSON.parse(await readLxConfigFile(path))
|
||||
settingData = await readLxConfigFile(path)
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
@ -830,12 +830,12 @@ export default {
|
|||
type: 'setting',
|
||||
data: Object.assign({ version: this.settingVersion }, this.setting),
|
||||
}
|
||||
saveLxConfigFile(path, JSON.stringify(data))
|
||||
saveLxConfigFile(path, data)
|
||||
},
|
||||
async importPlayList(path) {
|
||||
let listData
|
||||
try {
|
||||
listData = JSON.parse(await readLxConfigFile(path))
|
||||
listData = await readLxConfigFile(path)
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
@ -867,12 +867,12 @@ export default {
|
|||
if (item.otherSource) delete item.otherSource
|
||||
}
|
||||
}
|
||||
saveLxConfigFile(path, JSON.stringify(data))
|
||||
saveLxConfigFile(path, data)
|
||||
},
|
||||
async importAllData(path) {
|
||||
let allData
|
||||
try {
|
||||
allData = JSON.parse(await readLxConfigFile(path))
|
||||
allData = await readLxConfigFile(path)
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ export default {
|
|||
if (item.otherSource) delete item.otherSource
|
||||
}
|
||||
}
|
||||
saveLxConfigFile(path, JSON.stringify(allData))
|
||||
saveLxConfigFile(path, allData)
|
||||
},
|
||||
handleImportAllData() {
|
||||
selectDir({
|
||||
|
|
Loading…
Reference in New Issue