diff --git a/package-lock.json b/package-lock.json index 04bd163..3944172 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,19 @@ { "name": "lx-music-mobile", - "version": "1.7.0-beta.11", + "version": "1.7.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lx-music-mobile", - "version": "1.7.0-beta.11", + "version": "1.7.0", "license": "Apache-2.0", "dependencies": { "@craftzdog/react-native-buffer": "^6.0.5", "@react-native-async-storage/async-storage": "^2.1.0", "@react-native-clipboard/clipboard": "^1.16.1", "@react-native-community/slider": "^4.5.5", + "he": "^1.2.0", "iconv-lite": "^0.6.3", "lrc-file-parser": "^2.4.1", "message2call": "^0.1.3", @@ -41,6 +42,7 @@ "@react-native/metro-config": "^0.74.88", "@react-native/typescript-config": "^0.74.88", "@tsconfig/react-native": "^3.0.5", + "@types/he": "^1.2.3", "@types/react": "^18.3.18", "@types/react-native": "^0.72.8", "@types/react-native-background-timer": "^2.0.2", @@ -4224,6 +4226,13 @@ "integrity": "sha512-0+pmYzHccvwWpFz2Tv5AJxp6UroLALmAy+SX34tKlwaCie1mNbtCv6uOJp7x8pKchgNA9/n6BGrx7uLQvw8p9A==", "dev": true }, + "node_modules/@types/he": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@types/he/-/he-1.2.3.tgz", + "integrity": "sha512-q67/qwlxblDzEDvzHhVkwc1gzVWxaNxeyHUBF4xElrvjL11O+Ytze+1fGpBHlr/H9myiBUaUXNnNPmBHxxfAcA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -7904,6 +7913,15 @@ "node": ">= 0.4" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, "node_modules/hermes-estree": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.15.0.tgz", @@ -16484,6 +16502,12 @@ "integrity": "sha512-0+pmYzHccvwWpFz2Tv5AJxp6UroLALmAy+SX34tKlwaCie1mNbtCv6uOJp7x8pKchgNA9/n6BGrx7uLQvw8p9A==", "dev": true }, + "@types/he": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@types/he/-/he-1.2.3.tgz", + "integrity": "sha512-q67/qwlxblDzEDvzHhVkwc1gzVWxaNxeyHUBF4xElrvjL11O+Ytze+1fGpBHlr/H9myiBUaUXNnNPmBHxxfAcA==", + "dev": true + }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -19136,6 +19160,11 @@ "function-bind": "^1.1.2" } }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" + }, "hermes-estree": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.15.0.tgz", diff --git a/package.json b/package.json index 9f149d6..4601755 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@react-native-async-storage/async-storage": "^2.1.0", "@react-native-clipboard/clipboard": "^1.16.1", "@react-native-community/slider": "^4.5.5", + "he": "^1.2.0", "iconv-lite": "^0.6.3", "lrc-file-parser": "^2.4.1", "message2call": "^0.1.3", @@ -76,6 +77,7 @@ "@react-native/metro-config": "^0.74.88", "@react-native/typescript-config": "^0.74.88", "@tsconfig/react-native": "^3.0.5", + "@types/he": "^1.2.3", "@types/react": "^18.3.18", "@types/react-native": "^0.72.8", "@types/react-native-background-timer": "^2.0.2", diff --git a/publish/changeLog.md b/publish/changeLog.md index 7b2979c..c927dd2 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,56 +1,3 @@ -落雪祝大家新年快乐! - -### 关于之前提到的新项目 - -新项目我取名叫 Any Listen,希望它能像它的名字一样让我们能到处任意听歌。 -经过一年多的开发,因各种原因,实际进度比预期的慢,但还是赶在年前发布了第一个web服务预览版,第一个版本仅支持播放服务器上的歌曲,扩展功能暂时未能开放,但已趋于完成,一两个月内可以搞定。 -目前的版本仅是“能用”的状态,因时间关系,部分UI未能重新设计,但后面会继续完善。 -该项目目前的目标用户是拥有自己服务器且上面存储有歌曲的人使用。 - -项目刚发布,文档未能完善,遇到使用问题或有任何建议欢迎提 issue 交流, -项目地址: https://github.com/any-listen/any-listen - ---- - -*为了防止歌曲缓存被第三方软件当做垃圾意外清理,歌曲缓存不再存储到缓存目录。若想清理缓存,需去「设置 → 其他 → 资源缓存管理」清理。* - -*更新到该版本后首次播放歌曲时,会将之前的歌曲缓存迁移到新位置,需要等待的时间取决于你已缓存资源的大小。* - -*感谢 @3gf8jv4dv 对 LX 系列项目翻译、文档等文案的大幅修订优化。* - -### 新增 - -- 新增蓝牙歌词支持,可以通过「设置 → 播放设置 → 显示蓝牙歌词」启用(#615) -- 新增繁体中文语言(#659, @3gf8jv4dv) -- 将 LX Music 设置为「音乐应用」类,允许将 LX Music 设置为系统默认音乐播放器 -- 支持在程序外使用 LX Music 打开常见音乐文件及 `.js`、`.json`、`.lxmc` 等文件 - -### 优化 - -- 防止歌曲缓存被第三方软件当做垃圾意外清理 -- 优化正常播放结束时的下一首歌曲播放衔接度,在歌曲即将结束播放时将预获取下一首歌曲的播放链接,减少自动切歌时的等待时间 -- 优化歌曲换源机制,提升换源正确率 -- 首次使用的提示窗口可以通过点击背景或者返回键关闭(#577) -- 上移 Toast 位置避免遮挡播放模式图标(#603, @sibojia) -- 优化简体中文文案编排,大幅修订英语文案编排(#658, #660 等, @3gf8jv4dv) -- 优化应用图标质量,在高版本系统上使用矢量图标 - ### 修复 -- 修复导出文件到范围存储类型的目录时,扩展名丢失的问题 -- 修复切换列表播放歌曲时可能会出现播放的歌曲不对应的问题 -- 修复内置列表名称硬编码和语言切换显示的问题(#662) -- 修复某些情况下进播放详情页时,详情页不显示或应用界面无响应的问题 -- 修复低版本 Android 在某些情况下对 Emoji 字符编码的处理问题 - -### 变更 - -- 歌曲缓存不再存储到缓存目录 -- 不再长期缓存换源歌曲信息 - -### 其他 - -- 更新 Readme 文档,优化文案编排(#651, Thanks @3gf8jv4dv) -- 更新 Issue 模板(#652, @3gf8jv4dv) -- 更新项目文档(@3gf8jv4dv) -- 更新 React Native 到 v0.73.11 +- 修复 tx 歌单搜索名字、描述出现乱码的问题 diff --git a/src/screens/SonglistDetail/MusicList.tsx b/src/screens/SonglistDetail/MusicList.tsx index 267898e..d301139 100644 --- a/src/screens/SonglistDetail/MusicList.tsx +++ b/src/screens/SonglistDetail/MusicList.tsx @@ -31,7 +31,7 @@ export default forwardRef(({ componentId }, ref) headerRef.current?.setInfo({ name: (info.name || listDetailInfo.info.name) ?? '', // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - desc: info.desc || listDetailInfo.info.desc || '', + desc: listDetailInfo.info.desc || info.desc || '', playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '', imgUrl: info.img ?? listDetailInfo.info.img, }) @@ -43,7 +43,7 @@ export default forwardRef(({ componentId }, ref) headerRef.current?.setInfo({ name: (info.name || listDetailInfo.info.name) ?? '', // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - desc: info.desc || listDetailInfo.info.desc || '', + desc: listDetailInfo.info.desc || info.desc || '', playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '', imgUrl: info.img ?? listDetailInfo.info.img, }) @@ -54,7 +54,7 @@ export default forwardRef(({ componentId }, ref) headerRef.current?.setInfo({ name: (info.name || listDetailInfo.info.name) ?? '', // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - desc: info.desc || listDetailInfo.info.desc || '', + desc: listDetailInfo.info.desc || info.desc || '', playCount: (info.play_count ?? listDetailInfo.info.play_count) ?? '', imgUrl: info.img ?? listDetailInfo.info.img, }) diff --git a/src/utils/common.ts b/src/utils/common.ts index 8649358..e40ea37 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -71,18 +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) diff --git a/src/utils/index.ts b/src/utils/index.ts index 63fc3ed..b2c7ba1 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,5 @@ import { dateFormat } from './common' +import he from 'he' export { tranditionalize as langS2T } from '@/utils/simplify-chinese-main' @@ -192,3 +193,8 @@ export const formatPlayCount = (num: number): string => { if (num > 10000) return `${Math.trunc(num / 1000) / 10}万` return String(num) } + +export const decodeName = (str: string | null = '') => { + if (!str) return '' + return he.decode(str) +} diff --git a/src/utils/musicSdk/tx/songList.js b/src/utils/musicSdk/tx/songList.js index aa6c163..f118e4e 100644 --- a/src/utils/musicSdk/tx/songList.js +++ b/src/utils/musicSdk/tx/songList.js @@ -139,7 +139,7 @@ export default { img: item.cover_url_medium, // grade: item.favorcnt / 10, total: item.song_ids?.length, - desc: item.desc, + desc: decodeName(item.desc).replace(/
/g, '\n'), source: 'tx', })), total: data.total, @@ -307,13 +307,13 @@ export default { return { play_count: formatPlayCount(item.listennum), id: String(item.dissid), - author: item.creator.name, - name: item.dissname, + author: decodeName(item.creator.name), + name: decodeName(item.dissname), time: dateFormat(item.createtime, 'Y-M-D'), img: item.imgurl, // grade: item.favorcnt / 10, total: item.song_count, - desc: item.introduction, + desc: decodeName(decodeName(item.introduction)).replace(/
/g, '\n'), source: 'tx', } }), diff --git a/src/utils/musicSdk/utils.js b/src/utils/musicSdk/utils.js index 167c531..ccefff9 100644 --- a/src/utils/musicSdk/utils.js +++ b/src/utils/musicSdk/utils.js @@ -1,5 +1,5 @@ import { stringMd5 } from 'react-native-quick-md5' -import { decodeName } from '../common' +import { decodeName } from '../index' /** * 获取音乐音质