修复 tx 歌单搜索名字、描述出现乱码的问题(#2250)
parent
68b32a20a4
commit
3ac6d0ff5f
|
@ -1,3 +1,4 @@
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
- 修复 Windows 下桌面歌词最小高度设置问题(#2244)
|
- 修复 Windows 下桌面歌词最小高度设置问题(#2244)
|
||||||
|
- 修复 tx 歌单搜索名字、描述出现乱码的问题(#2250)
|
||||||
|
|
|
@ -71,19 +71,6 @@ export const formatPlayTime2 = (time: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const encodeNames = {
|
|
||||||
' ': ' ',
|
|
||||||
'&': '&',
|
|
||||||
'<': '<',
|
|
||||||
'>': '>',
|
|
||||||
'"': '"',
|
|
||||||
''': "'",
|
|
||||||
''': "'",
|
|
||||||
} as const
|
|
||||||
export const decodeName = (str: string | null = '') => {
|
|
||||||
return str?.replace(/(?:&|<|>|"|'|'| )/gm, (s: string) => encodeNames[s as keyof typeof encodeNames]) ?? ''
|
|
||||||
}
|
|
||||||
|
|
||||||
export const isUrl = (path: string) => /https?:\/\//.test(path)
|
export const isUrl = (path: string) => /https?:\/\//.test(path)
|
||||||
|
|
||||||
// 解析URL参数为对象
|
// 解析URL参数为对象
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { markRaw } from '@common/utils/vueTools'
|
import { markRaw } from '@common/utils/vueTools'
|
||||||
import { useRouter } from '@common/utils/vueRouter'
|
import { useRouter } from '@common/utils/vueRouter'
|
||||||
import { decodeName } from '@common/utils/common'
|
import { decodeName } from '@renderer/utils'
|
||||||
// import { allList, defaultList, loveList, userLists } from '@renderer/store/list'
|
// import { allList, defaultList, loveList, userLists } from '@renderer/store/list'
|
||||||
import { playMusicInfo, isShowPlayerDetail } from '@renderer/store/player/state'
|
import { playMusicInfo, isShowPlayerDetail } from '@renderer/store/player/state'
|
||||||
import { setShowPlayerDetail, addTempPlayList } from '@renderer/store/player/action'
|
import { setShowPlayerDetail, addTempPlayList } from '@renderer/store/player/action'
|
||||||
|
|
|
@ -75,3 +75,8 @@ export const deduplicationList = <T extends LX.Music.MusicInfo>(list: T[]): T[]
|
||||||
export const langS2T = async(str: string) => {
|
export const langS2T = async(str: string) => {
|
||||||
return window.lx.worker.main.langS2t(Buffer.from(str).toString('base64')).then(b64 => Buffer.from(b64, 'base64').toString())
|
return window.lx.worker.main.langS2t(Buffer.from(str).toString('base64')).then(b64 => Buffer.from(b64, 'base64').toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const decodeName = (str: string | null = '') => {
|
||||||
|
if (!str) return ''
|
||||||
|
return new window.DOMParser().parseFromString(str, 'text/html').body.textContent
|
||||||
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ export default {
|
||||||
img: item.cover_url_medium,
|
img: item.cover_url_medium,
|
||||||
// grade: item.favorcnt / 10,
|
// grade: item.favorcnt / 10,
|
||||||
total: item.song_ids?.length,
|
total: item.song_ids?.length,
|
||||||
desc: item.desc,
|
desc: decodeName(item.desc).replace(/<br>/g, '\n'),
|
||||||
source: 'tx',
|
source: 'tx',
|
||||||
})),
|
})),
|
||||||
total: data.total,
|
total: data.total,
|
||||||
|
@ -305,13 +305,13 @@ export default {
|
||||||
return {
|
return {
|
||||||
play_count: formatPlayCount(item.listennum),
|
play_count: formatPlayCount(item.listennum),
|
||||||
id: String(item.dissid),
|
id: String(item.dissid),
|
||||||
author: item.creator.name,
|
author: decodeName(item.creator.name),
|
||||||
name: item.dissname,
|
name: decodeName(item.dissname),
|
||||||
time: dateFormat(item.createtime, 'Y-M-D'),
|
time: dateFormat(item.createtime, 'Y-M-D'),
|
||||||
img: item.imgurl,
|
img: item.imgurl,
|
||||||
// grade: item.favorcnt / 10,
|
// grade: item.favorcnt / 10,
|
||||||
total: item.song_count,
|
total: item.song_count,
|
||||||
desc: item.introduction,
|
desc: decodeName(decodeName(item.introduction)).replace(/<br>/g, '\n'),
|
||||||
source: 'tx',
|
source: 'tx',
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import dns from 'dns'
|
import dns from 'dns'
|
||||||
import { decodeName } from '@common/utils/common'
|
import { decodeName } from '@renderer/utils'
|
||||||
|
|
||||||
export const toMD5 = str => crypto.createHash('md5').update(str).digest('hex')
|
export const toMD5 = str => crypto.createHash('md5').update(str).digest('hex')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue