Skip to content

Commit 850a429

Browse files
committed
优化代码逻辑,修复潜在播放问题
1 parent d3c8f16 commit 850a429

File tree

35 files changed

+85
-342
lines changed

35 files changed

+85
-342
lines changed

publish/changeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
- 修复备份文件导入指引无法识别v2配置的问题
55
- 修复从搜索界面进入歌单详情后,若启用强迫症设置的清空功能会导致意外清空搜索框、搜索列表的问题
6-
- 就放桌面歌词在启用卡拉OK歌词后字体边缘可能被截断的问题
6+
- 修复桌面歌词在启用卡拉OK歌词后字体边缘可能被截断的问题(特别是纵向歌词某些字的边角被截断导致后面的阴影露出来或阴影不均匀的问题)
77
- 修复桌面歌词启用歌词缩放后的阴影显示问题
88
- 修复Linux armv7l系统(如树莓派)下无法启动的问题(与修复Linux arm64的方法一样采用内置预编译模块的方式修复)
99
- 修复备份与恢复的列表导入列表信息设置逻辑问题与潜在导入问题

src/common/theme/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ exports.createThemeColors = (rgbaColor, fontRgbaColor, isDark) => {
3636
const createFontColors = (rgbaColor, isDark) => {
3737
// rgb(238, 238, 238)
3838
// let prec = 'rgb(255, 255, 255)'
39-
if (rgbaColor == null) rgbaColor = isDark ? 'rgb(229, 229, 229)' : 'rgb(33, 33, 33)'
39+
rgbaColor ??= isDark ? 'rgb(229, 229, 229)' : 'rgb(33, 33, 33)'
4040
if (isDark) return createFontDarkColors(rgbaColor)
4141

4242
let colors = {

src/common/utils/lyric-font-player/font-player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ module.exports = class FontPlayer {
141141
// lineText += text
142142

143143
if (this.shadowContent) {
144-
if (!lrcShadowContent) lrcShadowContent = document.createElement('div')
144+
lrcShadowContent ??= document.createElement('div')
145145
const shadowDom = document.createElement('span')
146146
shadowDom.textContent = text
147147
lrcShadowContent.appendChild(shadowDom)

src/common/utils/migrateSetting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default (setting: any): Partial<LX.AppSetting> => {
2525
// 迁移列表滚动位置设置 ~0.18.3
2626
if (setting.list?.scroll) {
2727
let scroll = setting.list.scroll
28-
if (setting.list.isSaveScrollLocation) setting.list.isSaveScrollLocation = scroll.enable
28+
setting.list.isSaveScrollLocation &&= scroll.enable
2929
delete setting.list.scroll
3030
}
3131

src/common/utils/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export const scrollXRTo = (element: HTMLElement, to: number, duration = 300, fn
244244
*/
245245
let dom_title = document.getElementsByTagName('title')[0]
246246
export const setTitle = (title: string | null) => {
247-
if (!title) title = '洛雪音乐助手'
247+
title ||= '洛雪音乐助手'
248248
dom_title.innerText = title
249249
}
250250

src/main/modules/sync/server/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const createClientKeyInfo = (deviceName: string): LX.Sync.KeyInfo => {
4444
deviceName,
4545
}
4646
const store = getStore(STORE_NAME)
47-
if (!keyInfos) keyInfos = store.get('keys') as KeyInfos || {}
47+
keyInfos ??= store.get('keys') as KeyInfos || {}
4848
if (Object.keys(keyInfos).length > 101) throw new Error('max keys')
4949

5050
keyInfos[keyInfo.clientId] = keyInfo

src/main/modules/userApi/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const winEvent = () => {
2727

2828
export const createWindow = async(userApi: LX.UserApi.UserApiInfo) => {
2929
await closeWindow()
30-
if (!dir) dir = global.isDev ? webpackUserApiPath : join(encodePath(__dirname), 'userApi')
30+
dir ??= global.isDev ? webpackUserApiPath : join(encodePath(__dirname), 'userApi')
3131

3232
if (!html) {
3333
html = await fs.promises.readFile(join(dir, 'renderer/user-api.html'), 'utf8')

src/main/modules/userApi/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const importApi = (script: string): LX.UserApi.UserApiInfo => {
3333
script,
3434
allowShowUpdateAlert: true,
3535
}
36-
if (!userApis) userApis = []
36+
userApis ??= []
3737
userApis.push(apiInfo)
3838
getStore(STORE_NAMES.USER_API).set('userApis', userApis)
3939
return apiInfo

src/main/modules/winMain/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const winEvent = () => {
2020
return
2121
}
2222

23-
if (global.lx.isTrafficLightClose) global.lx.isTrafficLightClose = false
23+
global.lx.isTrafficLightClose &&= false
2424
event.preventDefault()
2525
browserWindow!.hide()
2626
})

src/main/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const updateSetting = (setting?: Partial<LX.AppSetting>, isInit: boolean
113113

114114
let originSetting: LX.AppSetting
115115
if (isInit) {
116-
if (setting) setting = migrateSetting(setting)
116+
setting &&= migrateSetting(setting)
117117
originSetting = { ...defaultSetting }
118118
} else originSetting = global.lx.appSetting
119119

@@ -196,7 +196,7 @@ export const openDevTools = (webContents: Electron.WebContents) => {
196196

197197
let userThemes: LX.Theme[]
198198
export const getAllThemes = () => {
199-
if (!userThemes) userThemes = getStore(STORE_NAMES.THEME).get('themes') as LX.Theme[] | null ?? []
199+
userThemes ??= getStore(STORE_NAMES.THEME).get('themes') as (LX.Theme[] | null) ?? []
200200
return {
201201
themes,
202202
userThemes,

0 commit comments

Comments
 (0)