修复迁移旧版本配置失败的问题

pull/1057/head
lyswhut 2022-11-18 20:54:57 +08:00
parent 82176a831d
commit 3bc6fc97a2
1 changed files with 70 additions and 70 deletions

View File

@ -23,14 +23,14 @@ export default (setting: any): Partial<LX.AppSetting> => {
// 迁移 v2 之前的配置
if (compareVer(setting.version, '2.0.0') < 0) {
// 迁移列表滚动位置设置 ~0.18.3
if (setting.list.scroll) {
if (setting.list?.scroll) {
let scroll = setting.list.scroll
if (setting.list?.isSaveScrollLocation) setting.list.isSaveScrollLocation = scroll.enable
if (setting.list.isSaveScrollLocation) setting.list.isSaveScrollLocation = scroll.enable
delete setting.list.scroll
}
// 修正拼写问题 v1.8.2 及以前
if (setting.player.isShowLyricTransition != null) {
if (setting.player?.isShowLyricTransition != null) {
setting.player.isShowLyricTranslation = setting.player.isShowLyricTransition
delete setting.player.isShowLyricTransition
}
@ -43,7 +43,7 @@ export default (setting: any): Partial<LX.AppSetting> => {
delete setting.themeId
}
setting.tray.enable = setting.tray.isShow
if (setting.tray?.isShow != null) setting.tray.enable = setting.tray?.isShow
setting['common.windowSizeId'] = setting.windowSizeId
setting['common.startInFullscreen'] = setting.startInFullscreen
@ -56,83 +56,83 @@ export default (setting: any): Partial<LX.AppSetting> => {
setting['common.isAgreePact'] = setting.isAgreePact
setting['common.controlBtnPosition'] = setting.controlBtnPosition
setting['player.togglePlayMethod'] = setting.player.togglePlayMethod
setting['player.highQuality'] = setting.player.highQuality
setting['player.isShowTaskProgess'] = setting.player.isShowTaskProgess
setting['player.volume'] = setting.player.volume
setting['player.isMute'] = setting.player.isMute
setting['player.mediaDeviceId'] = setting.player.mediaDeviceId
setting['player.isMediaDeviceRemovedStopPlay'] = setting.player.isMediaDeviceRemovedStopPlay
setting['player.isShowLyricTranslation'] = setting.player.isShowLyricTranslation
setting['player.isShowLyricRoma'] = setting.player.isShowLyricRoma
setting['player.isS2t'] = setting.player.isS2t
setting['player.isPlayLxlrc'] = setting.player.isPlayLxlrc
setting['player.isSavePlayTime'] = setting.player.isSavePlayTime
setting['player.audioVisualization'] = setting.player.audioVisualization
setting['player.waitPlayEndStop'] = setting.player.waitPlayEndStop
setting['player.waitPlayEndStopTime'] = setting.player.waitPlayEndStopTime
setting['player.autoSkipOnError'] = setting.player.autoSkipOnError
setting['player.togglePlayMethod'] = setting.player?.togglePlayMethod
setting['player.highQuality'] = setting.player?.highQuality
setting['player.isShowTaskProgess'] = setting.player?.isShowTaskProgess
setting['player.volume'] = setting.player?.volume
setting['player.isMute'] = setting.player?.isMute
setting['player.mediaDeviceId'] = setting.player?.mediaDeviceId
setting['player.isMediaDeviceRemovedStopPlay'] = setting.player?.isMediaDeviceRemovedStopPlay
setting['player.isShowLyricTranslation'] = setting.player?.isShowLyricTranslation
setting['player.isShowLyricRoma'] = setting.player?.isShowLyricRoma
setting['player.isS2t'] = setting.player?.isS2t
setting['player.isPlayLxlrc'] = setting.player?.isPlayLxlrc
setting['player.isSavePlayTime'] = setting.player?.isSavePlayTime
setting['player.audioVisualization'] = setting.player?.audioVisualization
setting['player.waitPlayEndStop'] = setting.player?.waitPlayEndStop
setting['player.waitPlayEndStopTime'] = setting.player?.waitPlayEndStopTime
setting['player.autoSkipOnError'] = setting.player?.autoSkipOnError
setting['playDetail.isZoomActiveLrc'] = setting.playDetail.isZoomActiveLrc
setting['playDetail.isShowLyricProgressSetting'] = setting.playDetail.isShowLyricProgressSetting
setting['playDetail.style.fontSize'] = setting.playDetail.style.fontSize
setting['playDetail.style.align'] = setting.playDetail.style.align
setting['playDetail.isZoomActiveLrc'] = setting.playDetail?.isZoomActiveLrc
setting['playDetail.isShowLyricProgressSetting'] = setting.playDetail?.isShowLyricProgressSetting
setting['playDetail.style.fontSize'] = setting.playDetail?.style?.fontSize
setting['playDetail.style.align'] = setting.playDetail?.style?.align
setting['desktopLyric.enable'] = setting.desktopLyric.enable
setting['desktopLyric.isLock'] = setting.desktopLyric.isLock
setting['desktopLyric.isAlwaysOnTop'] = setting.desktopLyric.isAlwaysOnTop
setting['desktopLyric.isAlwaysOnTopLoop'] = setting.desktopLyric.isAlwaysOnTopLoop
setting['desktopLyric.width'] = setting.desktopLyric.width
setting['desktopLyric.height'] = setting.desktopLyric.height
setting['desktopLyric.x'] = setting.desktopLyric.x
setting['desktopLyric.y'] = setting.desktopLyric.y
setting['desktopLyric.isLockScreen'] = setting.desktopLyric.isLockScreen
setting['desktopLyric.isDelayScroll'] = setting.desktopLyric.isDelayScroll
setting['desktopLyric.isHoverHide'] = setting.desktopLyric.isHoverHide
setting['desktopLyric.style.font'] = setting.desktopLyric.style.font
setting['desktopLyric.style.fontSize'] = setting.desktopLyric.style.fontSize / 100 * 16
setting['desktopLyric.style.opacity'] = setting.desktopLyric.style.opacity
setting['desktopLyric.style.isZoomActiveLrc'] = setting.desktopLyric.style.isZoomActiveLrc
setting['desktopLyric.enable'] = setting.desktopLyric?.enable
setting['desktopLyric.isLock'] = setting.desktopLyric?.isLock
setting['desktopLyric.isAlwaysOnTop'] = setting.desktopLyric?.isAlwaysOnTop
setting['desktopLyric.isAlwaysOnTopLoop'] = setting.desktopLyric?.isAlwaysOnTopLoop
setting['desktopLyric.width'] = setting.desktopLyric?.width
setting['desktopLyric.height'] = setting.desktopLyric?.height
setting['desktopLyric.x'] = setting.desktopLyric?.x
setting['desktopLyric.y'] = setting.desktopLyric?.y
setting['desktopLyric.isLockScreen'] = setting.desktopLyric?.isLockScreen
setting['desktopLyric.isDelayScroll'] = setting.desktopLyric?.isDelayScroll
setting['desktopLyric.isHoverHide'] = setting.desktopLyric?.isHoverHide
setting['desktopLyric.style.font'] = setting.desktopLyric?.style?.font
if (setting.desktopLyric?.style?.fontSize) setting['desktopLyric.style.fontSize'] = setting.desktopLyric.style.fontSize / 100 * 16
setting['desktopLyric.style.opacity'] = setting.desktopLyric?.style?.opacity
setting['desktopLyric.style.isZoomActiveLrc'] = setting.desktopLyric?.style?.isZoomActiveLrc
setting['list.isClickPlayList'] = setting.list.isClickPlayList
setting['list.isShowAlbumName'] = setting.list.isShowAlbumName
setting['list.isShowSource'] = setting.list.isShowSource
setting['list.isSaveScrollLocation'] = setting.list.isSaveScrollLocation
setting['list.addMusicLocationType'] = setting.list.addMusicLocationType
setting['list.isClickPlayList'] = setting.list?.isClickPlayList
setting['list.isShowAlbumName'] = setting.list?.isShowAlbumName
setting['list.isShowSource'] = setting.list?.isShowSource
setting['list.isSaveScrollLocation'] = setting.list?.isSaveScrollLocation
setting['list.addMusicLocationType'] = setting.list?.addMusicLocationType
setting['download.enable'] = setting.download.enable
setting['download.savePath'] = setting.download.savePath
setting['download.fileName'] = setting.download.fileName
setting['download.maxDownloadNum'] = setting.download.maxDownloadNum
setting['download.isDownloadLrc'] = setting.download.isDownloadLrc
setting['download.lrcFormat'] = setting.download.lrcFormat
setting['download.isEmbedPic'] = setting.download.isEmbedPic
setting['download.isEmbedLyric'] = setting.download.isEmbedLyric
setting['download.isUseOtherSource'] = setting.download.isUseOtherSource
setting['download.enable'] = setting.download?.enable
setting['download.savePath'] = setting.download?.savePath
setting['download.fileName'] = setting.download?.fileName
setting['download.maxDownloadNum'] = setting.download?.maxDownloadNum
setting['download.isDownloadLrc'] = setting.download?.isDownloadLrc
setting['download.lrcFormat'] = setting.download?.lrcFormat
setting['download.isEmbedPic'] = setting.download?.isEmbedPic
setting['download.isEmbedLyric'] = setting.download?.isEmbedLyric
setting['download.isUseOtherSource'] = setting.download?.isUseOtherSource
setting['search.isShowHotSearch'] = setting.search.isShowHotSearch
setting['search.isShowHistorySearch'] = setting.search.isShowHistorySearch
setting['search.isFocusSearchBox'] = setting.search.isFocusSearchBox
setting['search.isShowHotSearch'] = setting.search?.isShowHotSearch
setting['search.isShowHistorySearch'] = setting.search?.isShowHistorySearch
setting['search.isFocusSearchBox'] = setting.search?.isFocusSearchBox
setting['network.proxy.enable'] = setting.network.proxy.enable
setting['network.proxy.host'] = setting.network.proxy.host
setting['network.proxy.port'] = setting.network.proxy.port
setting['network.proxy.username'] = setting.network.proxy.username
setting['network.proxy.password'] = setting.network.proxy.password
setting['network.proxy.enable'] = setting.network?.proxy?.enable
setting['network.proxy.host'] = setting.network?.proxy?.host
setting['network.proxy.port'] = setting.network?.proxy?.port
setting['network.proxy.username'] = setting.network?.proxy?.username
setting['network.proxy.password'] = setting.network?.proxy?.password
setting['tray.enable'] = setting.tray.enable
setting['tray.themeId'] = setting.tray.themeId
setting['tray.enable'] = setting.tray?.enable
setting['tray.themeId'] = setting.tray?.themeId
setting['sync.enable'] = setting.sync.enable
setting['sync.port'] = setting.sync.port
setting['sync.enable'] = setting.sync?.enable
setting['sync.port'] = setting.sync?.port
setting['theme.id'] = oldThemeMap[setting.theme.id as keyof typeof oldThemeMap]
setting['theme.lightId'] = oldThemeMap[setting.theme.lightId as keyof typeof oldThemeMap]
setting['theme.darkId'] = oldThemeMap[setting.theme.darkId as keyof typeof oldThemeMap]
setting['theme.id'] = oldThemeMap[setting.theme?.id as keyof typeof oldThemeMap]
setting['theme.lightId'] = oldThemeMap[setting.theme?.lightId as keyof typeof oldThemeMap]
setting['theme.darkId'] = oldThemeMap[setting.theme?.darkId as keyof typeof oldThemeMap]
setting['odc.isAutoClearSearchInput'] = setting.odc.isAutoClearSearchInput
setting['odc.isAutoClearSearchList'] = setting.odc.isAutoClearSearchList
setting['odc.isAutoClearSearchInput'] = setting.odc?.isAutoClearSearchInput
setting['odc.isAutoClearSearchList'] = setting.odc?.isAutoClearSearchList
}
return setting