diff --git a/publish/changeLog.md b/publish/changeLog.md index be623cc1..dfbb942b 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,7 +2,10 @@ - 新增启动参数`-dhmkh`,此参数将禁用Chromium的Hardware Media Key Handling特性,用于解决漫步者部分型号耳机与本程序冲突导致耳机意外关机的问题 +### 优化 + +- 程序启动时对数据文件做读取校验,数据出现损坏时自动备份损坏的数据,若出现数据读取错误的弹窗并出现我的列表丢失时可到GitHub或加群反馈 + ### 修复 - 修复备份与恢复功能在恢复数据时某些设置不立即生效的问题 - diff --git a/src/common/store.js b/src/common/store.js index 3b3f5060..86047fdb 100644 --- a/src/common/store.js +++ b/src/common/store.js @@ -10,6 +10,7 @@ const stores = {} * 获取 Store 对象 * @param {*} name store 名 * @param {*} isIgnoredError 是否忽略错误 + * @param {*} isShowErrorAlert 是否显示错误弹窗 * @returns Store */ module.exports = (name, isIgnoredError = true, isShowErrorAlert = true) => { @@ -25,13 +26,13 @@ module.exports = (name, isIgnoredError = true, isShowErrorAlert = true) => { const backPath = path.join(app.getPath('userData'), name + '.json.bak') fs.copyFileSync(path.join(app.getPath('userData'), name + '.json'), backPath) - shell.showItemInFolder(backPath) if (isShowErrorAlert) { dialog.showMessageBoxSync({ type: 'error', message: name + ' data load error', detail: `We have helped you back up the old ${name} file to: ${backPath}\nYou can try to repair and restore it manually\n\nError detail: ${error.message}`, }) + shell.showItemInFolder(backPath) } diff --git a/src/common/utils.js b/src/common/utils.js index 92fc68dc..be18ffed 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -123,9 +123,10 @@ exports.mergeSetting = (setting, version) => { /** * 初始化设置 * @param {*} setting + * @param {*} isShowErrorAlert */ -exports.initSetting = () => { - const electronStore_list = getStore('playList') +exports.initSetting = isShowErrorAlert => { + const electronStore_list = getStore('playList', true, isShowErrorAlert) const electronStore_config = getStore('config') const electronStore_downloadList = getStore('downloadList') diff --git a/src/main/utils/index.js b/src/main/utils/index.js index 5bbc0978..53c974bc 100644 --- a/src/main/utils/index.js +++ b/src/main/utils/index.js @@ -34,10 +34,10 @@ exports.saveAppHotKeyConfig = config => { exports.updateSetting = (settings) => { objectDeepMerge(global.appSetting, settings) getStore('config').set('setting', global.appSetting) - exports.initSetting() + exports.initSetting(false) } -exports.initSetting = () => { - const info = initSetting() +exports.initSetting = (isShowErrorAlert = true) => { + const info = initSetting(isShowErrorAlert) global.appSetting = info.setting global.appSettingVersion = info.version } diff --git a/src/renderer/lang/zh-cn/store/state.json b/src/renderer/lang/zh-cn/store/state.json index 3bba8d17..c57527e4 100644 --- a/src/renderer/lang/zh-cn/store/state.json +++ b/src/renderer/lang/zh-cn/store/state.json @@ -33,6 +33,6 @@ "source_alias_all": "聚合大会", - "load_list_file_error_title": "播放列表数据加载错误", + "load_list_file_error_title": "播放列表数据加载错误(建议到GitHub或加群反馈)", "load_list_file_error_detail": "我们已经帮你把旧的列表文件备份到{path}\n它以 JSON 格式存储,你可以尝试手动修复并恢复它\n\n错误详情:{detail}" }