Compare commits

...

148 Commits

Author SHA1 Message Date
lyswhut
ac7daa70f7 添加win arm 7z构建 2023-09-28 13:15:14 +08:00
lyswhut
0372f0647b 更新正式版构建流程 2023-09-28 12:54:00 +08:00
lyswhut
60f98ac438 发布v2.5.0 2023-09-28 12:02:32 +08:00
lyswhut
6d76814aed 更新依赖 2023-09-28 11:56:01 +08:00
lyswhut
2cf5bb689f 修复点击搜索、排行榜等在线列表歌曲右键菜单歌曲详情页会意外将该歌曲添加不喜欢的问题 2023-09-21 13:19:55 +08:00
lyswhut
e18c295ca6 更新版本号 2023-09-20 13:54:48 +08:00
lyswhut
58346d6fc9 优化不喜欢编辑框滚动条显示 2023-09-20 13:53:34 +08:00
lyswhut
5364b7a09b 通过歌曲菜单添加不喜欢歌曲时需要二次确认防止手抖 2023-09-20 13:41:25 +08:00
lyswhut
52630aa735 修复更换语言设置后源名称未更新的问题 2023-09-20 12:23:48 +08:00
lyswhut
89255a8c84 修复dev模式运行问题 2023-09-20 12:22:27 +08:00
lyswhut
6d5cc38235 更新构建设置 2023-09-20 11:09:11 +08:00
lyswhut
c4234ddcff 更新版本号 2023-09-17 14:06:51 +08:00
lyswhut
7a9872d42f 更新依赖 2023-09-17 14:00:49 +08:00
lyswhut
f5165d517c 修复音频输出设备设置在重启软件后被重置的问题(#1568) 2023-09-17 13:56:10 +08:00
lyswhut
0b125e29b5 新增Scheme URL对播放器的控制操作 2023-09-14 17:19:13 +08:00
lyswhut
aabd6d8985 更新依赖 2023-09-14 11:04:58 +08:00
lyswhut
94dccae48a 添加换源超时定时器 2023-09-12 12:52:31 +08:00
lyswhut
74ef112d57 修复同步数据字段顺序不一致的问题 2023-09-10 16:10:51 +08:00
lyswhut
0da63c6ef0 发布v2.4.1 2023-09-09 16:04:01 +08:00
lyswhut
3c145c7dd7 修复 v2.4.0 的默认数据库版本号不对导致无法启动问题 2023-09-09 15:52:51 +08:00
lyswhut
63590119bb 发布v2.4.0 2023-09-09 12:16:16 +08:00
lyswhut
7845d65119 修改code lint时机 2023-09-08 22:16:43 +08:00
lyswhut
2454738224 更新版本号 2023-09-06 21:58:08 +08:00
lyswhut
3685cb8868 修复潜在同步问题 2023-09-06 21:50:58 +08:00
lyswhut
fcffcb5b59 更新同步协商流程 2023-09-06 16:01:23 +08:00
lyswhut
19049fb890 修复信息更新问题 2023-09-06 12:21:12 +08:00
lyswhut
50950cc9d2 更新版本号 2023-09-06 12:02:38 +08:00
lyswhut
b1f9e525ab 新增同步功能对“不喜欢歌曲”列表的同步 2023-09-05 23:11:09 +08:00
lyswhut
fc03cd77fc 移除日志 2023-09-05 13:28:50 +08:00
lyswhut
9a3434b02e 新增设置-播放设置-点击相同列表内的歌曲切歌时是否清空已播放列表 2023-09-05 12:50:16 +08:00
lyswhut
eab5e51f66 修复潜在问题 2023-09-05 12:14:25 +08:00
lyswhut
ff6b7cbec2 更新better-sqlite3 2023-09-05 00:29:43 +08:00
lyswhut
abe62d84ed 修复同步功能列表元数据合并问题 2023-09-04 22:55:36 +08:00
lyswhut
1aa9627e4a 去重 2023-09-04 18:04:54 +08:00
lyswhut
8bbe549b0c 优化 2023-09-04 14:21:08 +08:00
lyswhut
baf69e397a 新增“不喜欢歌曲”功能&新增“收藏歌曲”、“取消收藏”、“不喜欢该歌曲”快捷键设置 2023-09-04 14:13:47 +08:00
lyswhut
3ca8f09971 优化歌词滚动 2023-09-03 18:08:10 +08:00
lyswhut
3381ad0e0e 修正事件名字 2023-09-03 17:29:43 +08:00
lyswhut
150342f699 单曲循环模式不应对“稍后播放”的歌曲有效 2023-09-03 00:58:31 +08:00
lyswhut
44830752f7 更新依赖 2023-09-02 13:50:09 +08:00
lyswhut
5e7ef691ae 优化歌词在短时间内快速播放时的滚动效果 2023-09-02 13:39:46 +08:00
lyswhut
ed858bafdc 修复kg无评论时的加载处理问题 2023-09-02 13:33:44 +08:00
lyswhut
2fff8652ca lint code 2023-08-30 14:30:47 +08:00
lyswhut
358142c1cc 更新新版本获取地址 2023-08-30 13:01:27 +08:00
lyswhut
903ca18b75 修改code lint的执行时机 2023-08-29 17:52:24 +08:00
lyswhut
6a91d3eec2 更新版本号 2023-08-29 17:50:22 +08:00
lyswhut
0d5e880fb2 优化同步服务逻辑 2023-08-29 17:46:16 +08:00
lyswhut
03f322f92a 优化桌面歌词在开启 缩放当前播放的歌词 并关闭 延迟歌词滚动 时的歌词滚动位置计算问题 2023-08-29 17:45:48 +08:00
lyswhut
5cf2acfff2 修复同步问题 2023-08-29 16:10:26 +08:00
lyswhut
7d17423e4b 新增数据同步服务端模式已认证设备列表管理 2023-08-29 15:40:42 +08:00
lyswhut
5d877d81e3 修复潜在问题 2023-08-29 12:32:31 +08:00
lyswhut
a968410431 添加连接超时处理 2023-08-28 16:04:58 +08:00
lyswhut
c6f4bfa875 修改同步逻辑 2023-08-28 13:39:23 +08:00
lyswhut
71b84fb10d lint code 2023-08-27 15:09:07 +08:00
lyswhut
0d76c9ccb4 重构同步服务端功能部分代码,使其更易扩展新功能 2023-08-25 19:13:50 +08:00
lyswhut
70815e276e 更新依赖 2023-08-21 20:18:24 +08:00
lyswhut
72fe8f3af1 修复潜在同步问题 2023-08-21 13:57:36 +08:00
lyswhut
53bc50d05c Revert vite build 2023-08-17 17:49:47 +08:00
lyswhut
99eb2856f7 更新版本号 2023-08-15 15:52:41 +08:00
lyswhut
616135ac14 修复某些UI显示异常的问题 2023-08-15 15:51:32 +08:00
lyswhut
5ca490d233 修正描述错误 2023-08-14 16:06:43 +08:00
lyswhut
1c159f59bb 优化同步逻辑 2023-08-14 15:33:59 +08:00
lyswhut
4ad9c81381 点击打开歌单弹窗背景将不再自动关闭弹窗 2023-08-11 22:22:37 +08:00
lyswhut
d11eaec7d5 opm 2023-08-11 14:30:01 +08:00
lyswhut
a02748d518 更新依赖 2023-08-11 14:21:59 +08:00
lyswhut
0ab2940347 修复本地文件解析异常时的错误处理问题 2023-08-11 14:17:17 +08:00
lyswhut
fc2585eb95 更新说明 2023-08-11 13:40:09 +08:00
lyswhut
c2789312ba 修复首句歌词被提前播放的问题 2023-08-11 13:28:29 +08:00
lyswhut
e1646a3127 修复windows平台下隐藏窗口后再显示时任务栏按钮丢失的问题 2023-08-10 21:08:16 +08:00
lyswhut
0fc1de9f29 移除日志输出 2023-08-09 14:37:54 +08:00
lyswhut
7c5969e580 修补依赖以使vite恢复构建 2023-08-09 14:37:48 +08:00
lyswhut
e719999d8a 移除多余代码 2023-08-08 20:05:22 +08:00
lyswhut
59ea4e4b44 修复构建 2023-08-07 18:56:26 +08:00
lyswhut
df52e8ede9 更新版本号 2023-08-07 18:50:35 +08:00
lyswhut
028bf5919d 从webpack迁移到vite 2023-08-07 18:49:14 +08:00
彭狸花喵
31e16a7ed7 优化kg评论区at显示 (#1515)
* 优化kg评论区at显示

* lint code

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-08-07 18:36:13 +08:00
lyswhut
aa6696dfcc 修复tx排行榜、歌单列表歌曲名称显示 2023-08-04 16:25:58 +08:00
彭狸花喵
838355a5e9 修复KGMusic歌单歌曲无扩展信息 & 修复QQMusic搜索歌曲无扩展信息 (#1509)
* fix: QQMusic搜索歌曲扩展信息

* 修复KGMusic调用musicInfo时无括号中数据

* 修复KGMusic歌单歌曲括号中信息

* 修复

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-08-03 20:30:48 +08:00
lyswhut
f87962f1a0 修复图片显示问题 2023-08-02 20:09:45 +08:00
lyswhut
8e4158d11d 更新默认设置 2023-08-01 11:35:15 +08:00
lyswhut
60f8f10bb5 过滤翻译歌词或罗马音歌词中只有“//”的行(#1499) 2023-07-30 14:45:35 +08:00
lyswhut
de5e1d7274 更新依赖 2023-07-30 12:32:20 +08:00
lyswhut
cfe78fc387 减少歌词定时器调用阈值 2023-07-30 12:32:12 +08:00
lyswhut
2a8bfac2c5 更新依赖 2023-07-25 15:49:11 +08:00
lyswhut
3c5c684641 优化音效设置-环境音效启用、禁用时的操作效果显示 2023-07-25 15:37:23 +08:00
lyswhut
c757ac8517 修复音效文件被意外重复打包的问题 2023-07-24 14:58:55 +08:00
lyswhut
2597ab4ea1 修复某些tx源歌词因数据异常解析失败的问题 2023-07-23 19:57:36 +08:00
Folltoshe
783799b2a4 更新酷我评论区带图消息 (#1471)
* 更新酷我评论区带图消息

* 移除多余代码

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-07-21 12:31:23 +08:00
lyswhut
87aec33833 添加说明 2023-07-19 12:04:35 +08:00
lyswhut
06087cd853 修复kw音质列表数据 2023-07-19 12:03:20 +08:00
lyswhut
afaef43017 更新依赖 2023-07-18 19:04:25 +08:00
lyswhut
e7f3f27104 修复搜索框在某些情况下输入内容后搜索时会自动清空的问题(#1472) 2023-07-18 18:39:12 +08:00
lyswhut
6c0e11eebc 添加说明 2023-07-14 15:11:10 +08:00
lyswhut
809752e4ec 修复若路径存在 # 字符时,软件无法启动的问题(#1461) 2023-07-14 15:01:05 +08:00
lyswhut
54f6255fe4 更新依赖 2023-07-11 15:18:08 +08:00
brstlig
d97a27307c 增加列表中歌曲随机乱序排列,修复专辑名排序无效bug (#1440)
* Update zh-cn.json

* Update ListSortModal.vue

* Add files via upload

* Update ListSortModal.vue

修复无法按专辑名排序bug,因变量名不一致导致

* 完善&优化

* 添加更新日志

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-07-11 15:04:13 +08:00
Folltoshe
6423066cb2 修复kw搜索联想词 (#1452)
* 修复kw搜索联想词

* 完善

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-07-07 23:54:32 +08:00
lyswhut
e8d8feb042 更新依赖 2023-07-04 21:34:18 +08:00
lyswhut
816caa6415 修复字体设置某些字体无法应用的问题 2023-07-04 19:47:19 +08:00
Folltoshe
a11d123815 修复歌曲排序时默认列表名称显示错误 (#1439) 2023-07-01 10:24:39 +08:00
lyswhut
c24d1d1e41 发布v2.3.0 2023-06-29 23:48:02 +08:00
lyswhut
1b2daef90c 更新依赖 2023-06-29 23:30:01 +08:00
lyswhut
6284fd8024 更新依赖 2023-06-27 18:58:51 +08:00
lyswhut
763874ac55 更新依赖 2023-06-26 10:53:46 +08:00
lyswhut
4defaa103e 修复linux arm64下无法启动的问题 2023-06-23 10:28:48 +08:00
Folltoshe
181ac937d2 修复mg歌单搜索 (#1414) 2023-06-21 12:30:06 +08:00
lyswhut
f6884524e2 更新依赖 2023-06-21 12:16:06 +08:00
lyswhut
23f118fb1a 过滤嵌入、下载的翻译、罗马音歌词时间标签(#1358) 2023-06-21 11:59:38 +08:00
lyswhut
a3b8f31b1e 修复tx翻译歌词解析丢失的问题 2023-06-21 10:58:04 +08:00
lyswhut
c6fb2232d0 修复mg歌单搜索歌单播放数量显示问题 2023-06-17 20:05:03 +08:00
lyswhut
ef411ddb47 更新依赖 2023-06-16 11:23:11 +08:00
lyswhut
7aed2828bb 修复添加单首歌曲弹窗列表创建按钮无法取消的问题 2023-06-16 11:23:08 +08:00
lyswhut
560445a518 添加提示 2023-06-14 11:46:50 +08:00
Folltoshe
3549ed2da0 修复wy热门评论显示 (#1411) 2023-06-14 11:25:10 +08:00
lyswhut
ec9f86c450 修复构建 2023-06-10 23:44:42 +08:00
lyswhut
c6e829be4f 更新依赖 2023-06-10 20:40:22 +08:00
lyswhut
5ef84916bb 修复初始化列表信息可能导致崩溃的问题 2023-06-10 20:34:25 +08:00
Folltoshe
94403be9a8 预留歌手API (#1407)
* 更新歌手API

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
Co-authored-by: 彭狸花喵 <helloplhm-qwq@outlook.com>
2023-06-10 20:33:21 +08:00
lyswhut
6403b8ce38 code lint 2023-06-09 09:55:54 +08:00
lyswhut
3f34fa26bf 更新依赖 2023-06-09 09:46:35 +08:00
彭狸花喵
b1a6c6b59c 更新kg最新评论接口(cmtlist->newest) & kg源歌手相关 (#1405)
* 修复wy源热搜词失效

* 更新kg最新评论接口(cmtlist->newest) & kg源歌手相关

---------

Co-authored-by: Folltoshe <folltoshe@foxmail.com>
2023-06-09 09:45:01 +08:00
lyswhut
76981a59d4 更新默认设置 2023-06-08 09:57:15 +08:00
Folltoshe
d93fbd699d 修复wy源热搜词 (#1403)
* 修复wy源热搜词失效

* 添加更新日志

---------

Co-authored-by: lyswhut <lyswhut@qq.com>
2023-06-08 09:50:16 +08:00
lyswhut
fd2dca0769 移除桌面歌词窗口透明边距 2023-06-05 23:12:43 +08:00
lyswhut
5097102ca1 修复Deepin 20下启用桌面歌词时可能会导致桌面卡死的问题 2023-06-05 22:36:00 +08:00
lyswhut
fa3fd8d8a4 Windows、MacOS平台下的字体列表改用原生方式获取 2023-06-05 15:05:03 +08:00
lyswhut
5582e78315 更新版本号 2023-06-04 13:13:02 +08:00
lyswhut
b7fd32067f 优化升降调性能占用 2023-06-04 12:53:46 +08:00
彭狸花喵
2a2fdc57bd 修复tx热门评论昵称被错误切割的问题 (#1397)
* 修复tx热门评论昵称被错误切割的问题

* fix

---------

Co-authored-by: Folltoshe <folltoshe@foxmail.com>
2023-06-04 12:14:34 +08:00
lyswhut
025739e35c 优化&更新依赖 2023-06-02 12:27:41 +08:00
lyswhut
c8f6153831 移除升降调预设 2023-06-01 14:35:46 +08:00
lyswhut
3c02e3dddc 更新版本号 2023-05-31 21:41:22 +08:00
lyswhut
40997c34ff 添加音调升降调节 2023-05-31 21:40:25 +08:00
lyswhut
677c3f16e4 播放速率设置面板新增是否音调补偿设置 2023-05-31 20:26:19 +08:00
lyswhut
0adb4f5ae5 修复改变播放速率时会导致歌词报错的问题 2023-05-31 09:07:35 +08:00
lyswhut
cbbcf914ad 更新依赖 2023-05-30 14:43:44 +08:00
lyswhut
d68a29a5a2 更新依赖 2023-05-25 14:30:20 +08:00
lyswhut
368eeed0d0 修复不同数据类型的列表id合并问题 2023-05-23 14:33:36 +08:00
lyswhut
a522b78496 更新依赖 2023-05-23 11:56:54 +08:00
lyswhut
dab81116e9 修复播放某些在线音频会没有声音的问题 2023-05-22 15:37:28 +08:00
lyswhut
b7f355bd1a 更新翻译 2023-05-21 10:34:56 +08:00
lyswhut
dbeaebaee3 更新版本号 2023-05-19 22:06:48 +08:00
lyswhut
fe94a1eac9 更新依赖,code lint 2023-05-19 22:01:18 +08:00
lyswhut
bd5107bbaf 修复下载时出现302错误的问题 2023-05-18 16:16:58 +08:00
lyswhut
8018d9b418 修复因插入数字类型的ID导致其意外在末尾追加 .0 导致列表数据异常的问题 2023-05-18 15:22:45 +08:00
lyswhut
0454d300ec 修改code判断方式 2023-05-16 17:35:42 +08:00
lyswhut
1e5c9ebc91 更新默认主题设置 2023-05-15 10:33:15 +08:00
lyswhut
5c7e9728e6 修复列表名翻译显示 2023-05-13 12:39:25 +08:00
425 changed files with 13849 additions and 8595 deletions

119
.eslintrc
View File

@@ -1,119 +0,0 @@
{
"root": true,
"extends": [
"standard"
],
"plugins": [
"html"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
// "requireConfigFile": false
},
"rules": {
"no-new": "off",
"camelcase": "off",
"no-return-assign": "off",
"space-before-function-paren": ["error", "never"],
"no-var": "error",
"no-fallthrough": "off",
"prefer-promise-reject-errors": "off",
"eqeqeq": "off",
"no-multiple-empty-lines": [1, {"max": 2}],
"comma-dangle": [2, "always-multiline"],
"standard/no-callback-literal": "off",
"prefer-const": "off",
"no-labels": "off",
"node/no-callback-literal": "off"
},
"ignorePatterns": ["vendors", "*.min.js", "dist"],
"overrides": [
{
"files": [ "*.vue" ],
"rules": {
"no-new": "off",
"camelcase": "off",
"no-return-assign": "off",
"space-before-function-paren": ["error", "never"],
"no-var": "error",
"no-fallthrough": "off",
"prefer-promise-reject-errors": "off",
"eqeqeq": "off",
"no-multiple-empty-lines": [1, {"max": 2}],
"comma-dangle": [2, "always-multiline"],
"standard/no-callback-literal": "off",
"prefer-const": "off",
"no-labels": "off",
"node/no-callback-literal": "off",
"vue/multi-word-component-names": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/ban-ts-comment": "off",
"vue/max-attributes-per-line": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/use-v-on-exact": "off",
"@typescript-eslint/restrict-template-expressions": "off",
// "no-undef": "off"
},
"parser": "vue-eslint-parser",
"extends": [
"plugin:vue/base",
// "plugin:vue/strongly-recommended"
"plugin:vue/vue3-recommended",
"standard-with-typescript",
],
"parserOptions": {
"sourceType": "module",
"parser": {
// Script parser for `<script>`
"js": "@typescript-eslint/parser",
// Script parser for `<script lang="ts">`
"ts": "@typescript-eslint/parser"
},
"extraFileExtensions": [".vue"]
}
},
{
"files": [ "*.ts" ],
"rules": {
"no-new": "off",
"camelcase": "off",
"no-return-assign": "off",
"space-before-function-paren": ["error", "never"],
"no-var": "error",
"no-fallthrough": "off",
"prefer-promise-reject-errors": "off",
"eqeqeq": "off",
"no-multiple-empty-lines": [1, {"max": 2}],
"comma-dangle": [2, "always-multiline"],
"standard/no-callback-literal": "off",
"prefer-const": "off",
"no-labels": "off",
"node/no-callback-literal": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/restrict-template-expressions": [1, {
"allowBoolean": true
}],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/return-await": "off",
"@typescript-eslint/ban-ts-comment": "off",
"multiline-ternary": "off",
"@typescript-eslint/comma-dangle": "off",
},
"parser": "@typescript-eslint/parser",
"extends": [
"standard-with-typescript"
],
"parserOptions": {
"project": "./src/**/tsconfig.json"
}
}
]
}

97
.eslintrc.base.cjs Normal file
View File

@@ -0,0 +1,97 @@
const baseRule = {
'no-new': 'off',
camelcase: 'off',
'no-return-assign': 'off',
'space-before-function-paren': ['error', 'never'],
'no-var': 'error',
'no-fallthrough': 'off',
eqeqeq: 'off',
'require-atomic-updates': ['error', { allowProperties: true }],
'no-multiple-empty-lines': [1, { max: 2 }],
'comma-dangle': [2, 'always-multiline'],
'standard/no-callback-literal': 'off',
'prefer-const': 'off',
'no-labels': 'off',
'node/no-callback-literal': 'off',
'multiline-ternary': 'off',
}
const typescriptRule = {
...baseRule,
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/restrict-template-expressions': [1, {
allowBoolean: true,
allowAny: true,
}],
'@typescript-eslint/restrict-plus-operands': [1, {
allowBoolean: true,
allowAny: true,
}],
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: {
arguments: false,
attributes: false,
},
},
],
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/return-await': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/comma-dangle': 'off',
}
const vueRule = {
...typescriptRule,
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/use-v-on-exact': 'off',
}
exports.base = {
extends: ['standard'],
rules: baseRule,
parser: '@babel/eslint-parser',
}
exports.html = {
files: ['*.html'],
plugins: ['html'],
}
exports.typescript = {
files: ['*.ts'],
rules: typescriptRule,
parser: '@typescript-eslint/parser',
extends: [
'standard-with-typescript',
],
}
exports.vue = {
files: ['*.vue'],
rules: vueRule,
parser: 'vue-eslint-parser',
extends: [
// 'plugin:vue/vue3-essential',
'plugin:vue/base',
'plugin:vue/vue3-recommended',
'plugin:vue-pug/vue3-recommended',
// "plugin:vue/strongly-recommended"
'standard-with-typescript',
],
parserOptions: {
sourceType: 'module',
parser: {
// Script parser for `<script>`
js: '@typescript-eslint/parser',
// Script parser for `<script lang="ts">`
ts: '@typescript-eslint/parser',
},
extraFileExtensions: ['.vue'],
},
}

20
.eslintrc.cjs Normal file
View File

@@ -0,0 +1,20 @@
const { base, typescript } = require('./.eslintrc.base.cjs')
module.exports = {
root: true,
...base,
overrides: [
{
...typescript,
parserOptions: {
project: './tsconfig.json',
},
},
],
ignorePatterns: [
'node_modules',
'*.min.js',
'dist',
'build',
],
}

View File

@@ -6,9 +6,41 @@ on:
- beta
jobs:
# CheckCode:
# name: Lint Code
# runs-on: ubuntu-latest
# steps:
# - name: Check out git repository
# uses: actions/checkout@v3
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version: '16'
# - name: Cache file
# uses: actions/cache@v3
# with:
# path: |
# node_modules
# $HOME/.cache/electron
# $HOME/.cache/electron-builder
# $HOME/.npm/_prebuilds
# key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-
# - name: Install Dependencies
# run: |
# npm ci
# - name: Lint src code
# run: npm run lint
Windows:
name: Windows
runs-on: windows-latest
# needs: CheckCode
steps:
- name: Check out git repository
uses: actions/checkout@v3
@@ -35,7 +67,7 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Build Package Setup x64
run: npm run pack:win:setup:x64
@@ -43,7 +75,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-Setup
path: build/* x64 Setup.exe
path: build/*-x64-Setup.exe
- name: Build Package 7z x64
run: npm run pack:win:7z:x64
@@ -51,23 +83,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_x64-green
path: build/*win_x64 green.7z
- name: Build Package Setup x86
run: npm run pack:win:setup:x86
- name: Upload Artifact Setup x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x86-Setup
path: build/* x86 Setup.exe
- name: Build Package 7z x86
run: npm run pack:win:7z:x86
- name: Upload Artifact 7z x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_x86-green
path: build/*win_x86 green.7z
path: build/*win_x64-green.7z
- name: Build Package Setup arm64
run: npm run pack:win:setup:arm64
@@ -75,7 +91,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-arm64-Setup
path: build/* arm64 Setup.exe
path: build/*-arm64-Setup.exe
- name: Build Package 7z arm64
run: npm run pack:win:7z:arm64
@@ -83,15 +99,27 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win_arm64-green
path: build/*win_arm64 green.7z
path: build/*win_arm64-green.7z
- name: Build Package Setup x86_64
run: npm run pack:win:setup:x86_64
- name: Upload Artifact Setup x86_64
- name: Install old electron
run: npm install electron@22
- name: Build Package win7 7z x64
run: npm run pack:win7:7z:x64
- name: Upload Artifact win7 7z x64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x86_64-Setup
path: build/*x86_64 Setup.exe
name: lx-music-desktop-win7_x64-green
path: build/*win7_x64-green.7z
- name: Build Package win7 7z x86
run: npm run pack:win7:7z:x86
- name: Upload Artifact win7 7z x86
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-win7_x86-green
path: build/*win7_x86-green.7z
- name: Generate file MD5
run: |
@@ -101,6 +129,7 @@ jobs:
Mac:
name: Mac
runs-on: macos-latest
# needs: CheckCode
steps:
- name: Check out git repository
uses: actions/checkout@v3
@@ -127,7 +156,7 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Build Package dmg
run: |
@@ -158,6 +187,7 @@ jobs:
Linux:
name: Linux
runs-on: ubuntu-latest
# needs: CheckCode
steps:
- name: Install package
run: sudo apt-get update && sudo apt-get install -y rpm libarchive-tools
@@ -187,15 +217,15 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Build Package deb x64
run: npm run pack:linux:deb:x64
- name: Upload Artifact deb x64
- name: Build Package deb amd64
run: npm run pack:linux:deb:amd64
- name: Upload Artifact deb amd64
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-x64
path: build/* x64.deb
name: lx-music-desktop-deb-amd64
path: build/*_amd64.deb
- name: Build Package deb arm64
run: npm run pack:linux:deb:arm64
@@ -203,7 +233,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-arm64
path: build/* arm64.deb
path: build/*_arm64.deb
- name: Build Package deb armv7l
run: npm run pack:linux:deb:armv7l
@@ -211,7 +241,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-deb-armv7l
path: build/* armv7l.deb
path: build/*_armv7l.deb
- name: Build Package x64 appImage
run: npm run pack:linux:appImage
@@ -219,7 +249,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-appImage
path: build/* x64.AppImage
path: build/*_x64.AppImage
- name: Build Package x64 rpm
run: npm run pack:linux:rpm
@@ -227,7 +257,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-rpm
path: build/* x64.rpm
path: build/*.x64.rpm
- name: Build Package x64 pacman
run: npm run pack:linux:pacman
@@ -235,7 +265,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: lx-music-desktop-x64-pacman
path: build/* x64.pacman
path: build/*_x64.pacman
- name: Generate file MD5
run: |

28
.github/workflows/build-test.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Run build test
on:
pull_request:
branches:
- dev
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out git repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Eslint check
run: npm run lint
- name: Test Build
run: npm run build

View File

@@ -0,0 +1,16 @@
name: Publish NPM Version Info
on:
release:
types: [published]
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.PAT }}
repository: lyswhut/lx-music-desktop-version-info
event-type: npm-release

View File

@@ -6,9 +6,41 @@ on:
- master
jobs:
# CheckCode:
# name: Lint Code
# runs-on: ubuntu-latest
# steps:
# - name: Check out git repository
# uses: actions/checkout@v3
# - name: Install Node.js
# uses: actions/setup-node@v3
# with:
# node-version: '16'
# - name: Cache file
# uses: actions/cache@v3
# with:
# path: |
# node_modules
# $HOME/.cache/electron
# $HOME/.cache/electron-builder
# $HOME/.npm/_prebuilds
# key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-
# - name: Install Dependencies
# run: |
# npm ci
# - name: Lint src code
# run: npm run lint
Windows:
name: Windows
runs-on: windows-latest
# needs: CheckCode
steps:
- name: Check out git repository
uses: actions/checkout@v3
@@ -35,17 +67,17 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Release package
run: |
npm run publish:win:setup:x64:always
npm run publish:win:7z:x64
npm run publish:win:setup:x86
npm run publish:win:7z:x86
npm run publish:win:setup:arm64
npm run publish:win:7z:arm64
npm run publish:win:setup:x86_64
npm run publish:win:setup:arm64
npm run publish:win:setup:x64
npm install electron@22
npm run publish:win7:7z:x64
npm run publish:win7:7z:x86
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BT_TOKEN: ${{ secrets.BT_TOKEN }}
@@ -58,6 +90,7 @@ jobs:
Mac:
name: Mac
runs-on: macos-latest
# needs: CheckCode
steps:
- name: Check out git repository
uses: actions/checkout@v3
@@ -84,11 +117,11 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Release package
run: |
npm run publish:mac:dmg:always
npm run publish:mac:dmg
npm run publish:mac:dmg:arm64
env:
ELECTRON_CACHE: $HOME/.cache/electron
@@ -104,6 +137,7 @@ jobs:
Linux:
name: Linux
runs-on: ubuntu-latest
# needs: CheckCode
steps:
- name: Install package
run: sudo apt-get update && sudo apt-get install -y rpm libarchive-tools
@@ -133,11 +167,11 @@ jobs:
npm ci
- name: Build src code
run: npm run build:src
run: npm run build
- name: Release package
run: |
npm run publish:linux:deb:x64:always
npm run publish:linux:deb:amd64
npm run publish:linux:deb:arm64
npm run publish:linux:deb:armv7l
npm run publish:linux:appImage

View File

@@ -5,11 +5,22 @@ module.exports = {
'chalk',
'del',
'comlink',
'vue',
'@types/ws',
// 'eslint-config-standard-with-typescript',
'typescript', // https://github.com/microsoft/TypeScript/pull/54567
],
// target: 'newest',
// filter: [
// 'electron-builder',
// 'electron-updater',
// 'electron-log',
// ],
// target: 'patch',
// filter: [
// 'vue',
// ],
// target: 'minor',

View File

@@ -6,6 +6,124 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/).
Commit convention is based on [Conventional Commits](http://conventionalcommits.org).
Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
## [2.5.0](https://github.com/lyswhut/lx-music-desktop/compare/v2.4.1...v2.5.0) - 2023-09-28
落雪提前祝大家中秋快乐~🥮😘!
### 不兼容性变更
- 由于微软及Electron即将结束对 Windows 7、Windows 8 的支持所以从这个版本起LX的默认 Windows 版也不再支持这些版本的系统,但考虑到仍然有许多人使用 Windows 7我们特别构建了能在 Windows 7 上使用的免安装版文件名带win7需要注意的是这个版本将缺乏安全更新若非必要情况不要使用该版本
- 由于微软在 Windows 10 2004版本已删除对32位的OEM支持所以在这个版本起LX的默认 Windows 版已不再提供32位的支持
- 更改构建的文件名格式主要修改linux下deb、rpm文件命名格式
### 新增
- 新增Scheme URL对播放器的控制操作新增的操作包含 播放、暂停、下一首、上一首等详情看Scheme URL文档
### 优化
- 通过歌曲菜单添加不喜欢歌曲时需要二次确认防止手抖
### 修复
- 修复音频输出设备设置在重启软件后被重置的问题(#1568
- 修复更换语言设置后源名称未更新的问题
- 修复点击搜索、排行榜等在线列表歌曲右键菜单歌曲详情页会意外将该歌曲添加不喜欢的问题
### 其他
- 更新 electron 到 v25.8.3
## [2.4.1](https://github.com/lyswhut/lx-music-desktop/compare/v2.4.0...v2.4.1) - 2023-09-09
目前本项目的原始发布地址只有 **GitHub****蓝奏网盘** ,其他渠道均为第三方转载发布,可信度请自行鉴别。
本项目无微信公众号之类的官方账号,谨防被骗。
### 修复
- 修复 v2.4.0 的默认数据库版本号不对导致首次安装该版本的用户无法再次启动软件的问题
## [2.4.0](https://github.com/lyswhut/lx-music-desktop/compare/v2.3.0...v2.4.0) - 2023-09-09
目前本项目的原始发布地址只有 **GitHub****蓝奏网盘** ,其他渠道均为第三方转载发布,可信度请自行鉴别。
本项目无微信公众号之类的官方账号,谨防被骗。
### 不兼容性变更
该版本修改了同步协议逻辑同步功能至少需要PC端v2.4.0或移动端v1.1.0版本或同步服务v2.0.0才能连接使用。
### 新增
- 新增我的列表名右键菜单-排序歌曲-随机乱序功能,使用它可以对选中列表内歌曲进行随机重排(#1440
- 新增数据同步服务端模式已认证设备列表管理,该功能位置:设置-数据同步-服务端模式-已认证设备列表
- 新增“不喜欢歌曲”功能,可以在我的列表或者在线列表内歌曲的右击菜单使用,还可以去“设置-其他”手动编辑不喜欢规则,注:“上一曲”、“下一曲”功能将跳过符合“不喜欢歌曲”规则的歌曲,但你仍可以手动播放这些歌曲
- 新增同步功能对“不喜欢歌曲”列表的同步
- 新增软件内快捷键“不喜欢该歌曲”设置,全局快捷键“收藏歌曲”、“取消收藏”、“不喜欢该歌曲”设置
- 新增设置-播放设置-点击相同列表内的歌曲切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)选项,默认关闭
### 优化
- 优化音效设置-环境音效启用、禁用时的操作效果显示,修复禁用环境音效时仍然可以调整增益、新增预设的问题
- 过滤翻译歌词或罗马音歌词中只有“//”的行(#1499
- 点击打开歌单弹窗背景将不再自动关闭弹窗,防止选择输入框里的内容时意外关闭弹窗
- 优化数据传输逻辑,列表同步指令使用队列机制,保证列表同步操作的顺序
- 优化桌面歌词在开启 缩放当前播放的歌词 并关闭 延迟歌词滚动 时的歌词滚动位置计算问题,现在歌词滚动应该可以正确滚动到目标位置了
- 优化歌词在短时间内快速播放时的滚动效果,现在遇到这种情况时滚动将更平滑
### 修复
- 修复字体设置某些字体无法应用的问题
- 修复搜索提示功能失效的问题(#1452, @Folltoshe
- 修复我的列表名右键菜单-排序歌曲按专辑名排序无效的问题(#1440
- 修复若路径存在 # 字符时,软件无法启动的问题
- 修复搜索框在某些情况下输入内容后搜索时会自动清空的问题(#1472
- 修复某些tx源歌词因数据异常解析失败的问题
- 修复windows平台下隐藏窗口后再显示时任务栏按钮丢失的问题
- 修复首句歌词被提前播放的问题
- 修复潜在导致列表数据不同步的问题
- 修复kg无评论时的加载处理问题
### 变更
- 播放模式应该只适用于列表内的歌曲,所以单曲循环模式不应对“稍后播放”的歌曲有效,该行为现在与移动端一致
- 随机模式下,通过点击与播放列表相同的列表切歌时,将不再清空已播放列表,即已播放的歌曲不再重新参与随机,若想恢复之前的行为可以去设置-播放设置启用清空已播放列表选项
### 其他
- 更新 electron 到 v22.3.23
- 重构同步服务端功能部分代码,使其更易扩展新功能
## [2.3.0](https://github.com/lyswhut/lx-music-desktop/compare/v2.2.2...v2.3.0) - 2023-06-29
### 新增
- 新增音效设置实验性功能支持10段均衡器设置、内置的一些环境混响音效、音调升降调节、3D立体环绕音效由于升降调需要实时处理音频数据这会导致额外的CPU占用已知问题如果CPU资源不够时将处理导致任务堆积而出现声音异常这时需要暂停播放一段时间等堆积的任务处理完毕再播放
- 播放速率设置面板新增是否音调补偿设置,在调整播放速率后,可以选择是否启用音调补偿,默认启用
### 优化
- Windows、MacOS平台下的字体列表改用原生方式获取现在Windows平台下能显示当前已安装的更多类型字体了MacOS平台未测可用性未知
- 移除桌面歌词窗口透明边距在Linux下的桌面歌词可以完全拖到贴合屏幕边缘了
- 过滤嵌入、下载的翻译、罗马音歌词时间标签,与主歌词时间不匹配的歌词将被丢弃,防止出现原歌词与翻译歌词顺序错乱的问题(#1358
### 修复
- 修复列表名翻译显示
- 修复因插入数字类型的ID导致其意外在末尾追加 .0 导致列表数据异常的问题,同时也可能导致同步数据丢失的问题(要完全修复这个问题还需要同时将移动端、同步服务更新到最新版本)
- 修复下载时出现302错误的问题
- 修复播放某些在线音频会没有声音的问题
- 修复改变播放速率时会导致歌词报错的问题
- 修复tx热门评论昵称被错误切割的问题 (#1397, By: @helloplhm-qwq, @Folltoshe)
- 修复wy源热搜词失效的问题#1401, @Folltoshe
- 修复Deepin 20下启用桌面歌词时可能会导致桌面卡死的问题#1288
- 修复添加单首歌曲弹窗列表创建按钮无法取消的问题
- 修复mg歌单搜索歌单播放数量显示问题
- 修复tx翻译歌词解析丢失的问题更新版本后需手动清理一次歌词缓存
### 其他
- 更新 electron 到 v22.3.15
## [2.2.2](https://github.com/lyswhut/lx-music-desktop/compare/v2.2.1...v2.2.2) - 2023-05-01
### 修复

View File

@@ -52,6 +52,8 @@
目前本项目的原始发布地址只有**GitHub**及**蓝奏网盘**,其他渠道均为第三方转载发布,与本项目无关!
为了提高使用门槛本软件内的默认设置、UI操作不以新手友好为目标所以使用前建议先根据你的喜好浏览调整一遍软件设置阅读一遍[音乐播放列表机制](https://lyswhut.github.io/lx-music-doc/desktop/faq/playlist)及[可用的鼠标、键盘快捷操作](https://lyswhut.github.io/lx-music-doc/desktop/faq/hotkey)
#### Scheme URL支持
从v1.17.0起支持 Scheme URL可以使用此功能从浏览器等场景下调用LX Music我们开发了一个[油猴脚本](https://github.com/lyswhut/lx-music-script#readme)配套使用,<br>
@@ -89,25 +91,7 @@
### 源码使用方法
环境要求Node.js 16+
```bash
# 开发模式
npm run dev
# 构建免安装版
npm run pack:dir
# 构建安装包Windows版
npm run pack:win
# 构建安装包Mac版
npm run pack:mac
# 构建安装包Linux版
npm run pack:linux
```
已迁移至:<https://lyswhut.github.io/lx-music-doc/desktop/use-source-code>
### UI界面
@@ -129,7 +113,7 @@ npm run pack:linux
1. 参照[源码使用方法](https://lyswhut.github.io/lx-music-doc/desktop/use-source-code)设置开发环境
2. 克隆本仓库代码并切换到`dev`分支开发
3. 提交PR
3. 提交PR`dev`分支
### 项目协议

View File

@@ -16,7 +16,7 @@ module.exports = async(context) => {
const resPath = `${appOutDir}/${productFilename}.app/Contents/Resources`
// 创建APP语言包文件
return await Promise.all(
return Promise.all(
Object.entries(macLanguagesInfoPlistStrings).map(([lang, config]) => {
let infos = Object.entries(config).map(([k, v]) => `"${k}" = "${v}";`).join('\n')
return fs.writeFile(`${resPath}/${lang}.lproj/InfoPlist.strings`, infos)

View File

@@ -2,45 +2,47 @@ const fs = require('fs')
const fsPromises = require('fs').promises
const path = require('path')
const { Arch } = require('electron-builder')
const nodeAbi = require('node-abi')
const better_sqlite3_fileNameMap = {
[Arch.x64]: 'electron-v110-linux-x64',
[Arch.arm64]: 'electron-v110-linux-arm64',
[Arch.armv7l]: 'electron-v110-linux-arm',
[Arch.x64]: 'linux-x64',
[Arch.arm64]: 'linux-arm64',
[Arch.armv7l]: 'linux-arm',
}
const qrc_decode_fileNameMap = {
win32: {
[Arch.x64]: 'electron-v110-win32-x64',
[Arch.ia32]: 'electron-v110-win32-ia32',
[Arch.arm64]: 'electron-v110-win32-arm64',
[Arch.x64]: 'win32-x64',
[Arch.ia32]: 'win32-ia32',
[Arch.arm64]: 'win32-arm64',
},
linux: {
[Arch.x64]: 'electron-v110-linux-x64',
[Arch.arm64]: 'electron-v110-linux-arm64',
[Arch.armv7l]: 'electron-v110-linux-arm',
[Arch.x64]: 'linux-x64',
[Arch.arm64]: 'linux-arm64',
[Arch.armv7l]: 'linux-arm',
},
darwin: {
[Arch.x64]: 'electron-v110-darwin-x64',
[Arch.arm64]: 'electron-v110-darwin-arm64',
[Arch.x64]: 'darwin-x64',
[Arch.arm64]: 'darwin-arm64',
},
}
const replaceSqliteLib = async(arch) => {
const replaceSqliteLib = async(electronNodeAbi, arch) => {
// console.log(await fs.readdir(path.join(context.appOutDir, './resources/')))
// if (context.electronPlatformName != 'linux' || context.arch != Arch.arm64) return
// https://github.com/lyswhut/lx-music-desktop/issues/1102
// https://github.com/lyswhut/lx-music-desktop/issues/1161
console.log('replace sqlite lib...')
const filePath = path.join(__dirname, `./lib/better_sqlite3_${better_sqlite3_fileNameMap[arch]}.node`)
const filePath = path.join(__dirname, `./lib/better_sqlite3_electron-v${electronNodeAbi}-${better_sqlite3_fileNameMap[arch]}.node`)
console.log(filePath)
const targetPath = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
await fsPromises.unlink(targetPath).catch(_ => _)
await fsPromises.copyFile(filePath, targetPath)
}
const replaceQrcDecodeLib = async(platform, arch) => {
console.log('replace qrc_decode lib...', platform, qrc_decode_fileNameMap[platform][arch])
const filePath = path.join(__dirname, `./lib/qrc_decode_${qrc_decode_fileNameMap[platform][arch]}.node`)
const replaceQrcDecodeLib = async(electronNodeAbi, platform, arch) => {
console.log('replace qrc_decode lib...', platform, electronNodeAbi, qrc_decode_fileNameMap[platform][arch])
const filePath = path.join(__dirname, `./lib/qrc_decode_electron-v${electronNodeAbi}-${qrc_decode_fileNameMap[platform][arch]}.node`)
const targetPath = path.join(__dirname, '../build/Release/qrc_decode.node')
const targetDir = path.dirname(targetPath)
if (fs.existsSync(targetDir)) await fsPromises.unlink(targetPath).catch(_ => _)
@@ -51,7 +53,9 @@ const replaceQrcDecodeLib = async(platform, arch) => {
module.exports = async(context) => {
const { electronPlatformName, arch } = context
await replaceQrcDecodeLib(electronPlatformName, arch)
const electronVersion = context.packager?.info?._framework?.version ?? require('../package.json').devDependencies.electron.replace(/.*?(\d+)/, '$1')
const electronNodeAbi = nodeAbi.getAbi(electronVersion, 'electron')
await replaceQrcDecodeLib(electronNodeAbi, electronPlatformName, arch)
if (electronPlatformName !== 'linux' || process.env.FORCE) return
const bindingFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp')
const bindingBakFilePath = path.join(__dirname, '../node_modules/better-sqlite3/binding.gyp.bak')
@@ -63,7 +67,7 @@ module.exports = async(context) => {
// console.log('rename binding file...')
await fsPromises.rename(bindingFilePath, bindingBakFilePath)
}
await replaceSqliteLib(arch)
await replaceSqliteLib(electronNodeAbi, arch)
break
default:

297
build-config/build-pack.js Normal file
View File

@@ -0,0 +1,297 @@
/* eslint-disable no-template-curly-in-string */
const builder = require('electron-builder')
const beforePack = require('./build-before-pack')
const afterPack = require('./build-after-pack')
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const options = {
appId: 'cn.toside.music.desktop',
beforePack,
afterPack,
protocols: {
name: 'lx-music-protocol',
schemes: [
'lxmusic',
],
},
directories: {
buildResources: './resources',
output: './build',
},
files: [
'!node_modules/**/*',
'node_modules/font-list',
'node_modules/better-sqlite3/lib',
'node_modules/better-sqlite3/package.json',
'node_modules/better-sqlite3/build/Release/better_sqlite3.node',
'node_modules/electron-font-manager/index.js',
'node_modules/electron-font-manager/package.json',
'node_modules/electron-font-manager/build/Release/font_manager.node',
'node_modules/node-gyp-build',
'node_modules/bufferutil',
'node_modules/utf-8-validate',
'build/Release/qrc_decode.node',
'dist/**/*',
],
asar: {
smartUnpack: false,
},
extraResources: [
'./licenses',
],
publish: [
{
provider: 'github',
owner: 'lyswhut',
repo: 'lx-music-desktop',
},
],
}
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const winOptions = {
win: {
icon: './resources/icons/icon.ico',
legalTrademarks: 'lyswhut',
// artifactName: '${productName}-v${version}-${env.ARCH}-${env.TARGET}.${ext}',
},
nsis: {
oneClick: false,
language: '2052',
allowToChangeInstallationDirectory: true,
differentialPackage: true,
license: './licenses/license.rtf',
shortcutName: 'LX Music',
},
}
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const linuxOptions = {
linux: {
maintainer: 'lyswhut <lyswhut@qq.com>',
// artifactName: '${productName}-${version}.${env.ARCH}.${ext}',
icon: './resources/icons',
category: 'Utility;AudioVideo;Audio;Player;Music;',
desktop: {
Name: 'LX Music',
'Name[zh_CN]': 'LX Music',
'Name[zh_TW]': 'LX Music',
Encoding: 'UTF-8',
MimeType: 'x-scheme-handler/lxmusic',
StartupNotify: 'false',
},
},
appImage: {
license: './licenses/license_zh.txt',
category: 'Utility;AudioVideo;Audio;Player;Music;',
},
}
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const macOptions = {
mac: {
icon: './resources/icons/icon.icns',
category: 'public.app-category.music',
// artifactName: '${productName}-${version}.${ext}',
},
dmg: {
window: {
width: 600,
height: 400,
},
contents: [
{
x: 106,
y: 252,
name: 'LX Music',
},
{
x: 490,
y: 252,
type: 'link',
path: '/Applications',
},
],
title: '洛雪音乐助手 v${version}',
},
}
// win: {
// tagret: {
// setup: ['nsis', '${productName}-v${version}-${env.ARCH}-Setup.${ext}'],
// green: ['7z', '${productName}-v${version}-${env.ARCH}-green.${ext}'],
// portable: ['portable', '${productName}-v${version}-${env.ARCH}-portable.${ext}'],
// },
// },
// linux: {
// platform: Platform.WINDOWS,
// arch: {
// x64: builder.Arch.x64,
// arm64: builder.Arch.arm64,
// armv7l: builder.Arch.armv7l,
// },
// tagret: {
// deb: ['deb', '${productName}_${version}_${env.ARCH}.${ext}'],
// appImage: ['AppImage', '${productName}_${version}_${env.ARCH}.${ext}'],
// pacman: ['pacman', '${productName}_${version}_${env.ARCH}.${ext}'],
// rpm: ['rpm', '${productName}-${version}.${env.ARCH}.${ext}'],
// },
// },
// mac: {
// arch: {
// x64: builder.Arch.x64,
// x86: builder.Arch.ia32,
// arm64: builder.Arch.arm64,
// },
// tagret: {
// dmg: ['dmg', '${productName}-${version}-${env.ARCH}.${ext}'],
// },
// },
const createTarget = {
/**
*
* @param {*} arch
* @param {*} packageType
* @returns {{ buildOptions: import('electron-builder').CliOptions, options: import('electron-builder').Configuration }}
*/
win(arch, packageType) {
switch (packageType) {
case 'setup':
winOptions.artifactName = `\${productName}-v\${version}-${arch}-Setup.\${ext}`
return {
buildOptions: { win: ['nsis'] },
options: winOptions,
}
case 'green':
winOptions.artifactName = `\${productName}-v\${version}-win_${arch}-green.\${ext}`
return {
buildOptions: { win: ['7z'] },
options: winOptions,
}
case 'win7_green':
winOptions.artifactName = `\${productName}-v\${version}-win7_${arch}-green.\${ext}`
return {
buildOptions: { win: ['7z'] },
options: winOptions,
}
case 'portable':
winOptions.artifactName = `\${productName}-v\${version}-${arch}-portable.\${ext}`
return {
buildOptions: { win: ['portable'] },
options: winOptions,
}
default: throw new Error('Unknown package type: ' + packageType)
}
},
/**
*
* @param {*} arch
* @param {*} packageType
* @returns {{ buildOptions: import('electron-builder').CliOptions, options: import('electron-builder').Configuration }}
*/
linux(arch, packageType) {
switch (packageType) {
case 'deb':
linuxOptions.artifactName = `\${productName}_\${version}_${arch == 'x64' ? 'amd64' : arch}.\${ext}`
return {
buildOptions: { linux: ['deb'] },
options: linuxOptions,
}
case 'appImage':
linuxOptions.artifactName = `\${productName}_\${version}_${arch}.\${ext}`
return {
buildOptions: { linux: ['AppImage'] },
options: linuxOptions,
}
case 'pacman':
linuxOptions.artifactName = `\${productName}_\${version}_${arch}.\${ext}`
return {
buildOptions: { linux: ['pacman'] },
options: linuxOptions,
}
case 'rpm':
linuxOptions.artifactName = `\${productName}-\${version}.${arch}.\${ext}`
return {
buildOptions: { linux: ['rpm'] },
options: linuxOptions,
}
default: throw new Error('Unknown package type: ' + packageType)
}
},
/**
*
* @param {*} arch
* @param {*} packageType
* @returns {{ buildOptions: import('electron-builder').CliOptions, options: import('electron-builder').Configuration }}
*/
mac(arch, packageType) {
switch (packageType) {
case 'dmg':
macOptions.artifactName = `\${productName}-\${version}-${arch}.\${ext}`
return {
buildOptions: { mac: ['dmg'] },
options: macOptions,
}
default: throw new Error('Unknown package type: ' + packageType)
}
},
}
/**
*
* @param {'win' | 'mac' | 'linux' | 'dir'} target 构建目标平台
* @param {'x86_64' | 'x64' | 'x86' | 'arm64' | 'armv7l'} arch 包架构
* @param {*} packageType 包类型
* @param {'onTagOrDraft' | 'always' | 'never'} publishType 发布类型
*/
const build = async(target, arch, packageType, publishType) => {
if (target == 'dir') {
await builder.build({
dir: true,
config: { ...options, ...winOptions, ...linuxOptions, ...macOptions },
})
return
}
const targetInfo = createTarget[target](arch, packageType)
// Promise is returned
await builder.build({
...targetInfo.buildOptions,
publish: publishType ?? 'never',
x64: arch == 'x64' || arch == 'x86_64',
ia32: arch == 'x86' || arch == 'x86_64',
arm64: arch == 'arm64',
armv7l: arch == 'armv7l',
config: { ...options, ...targetInfo.options },
})
// .then((result) => {
// console.log(JSON.stringify(result))
// })
// .catch((error) => {
// console.error(error)
// })
}
const params = {}
for (const param of process.argv.slice(2)) {
const [name, value] = param.split('=')
params[name] = value
}
if (params.target == null) throw new Error('Missing target')
if (params.target != 'dir' && params.arch == null) throw new Error('Missing arch')
if (params.target != 'dir' && params.type == null) throw new Error('Missing type')
console.log(params.target, params.arch, params.type, params.publish ?? '')
build(params.target, params.arch, params.type, params.publish)

View File

@@ -0,0 +1,38 @@
// 修补依赖源码以使vite构建的依赖恢复正常工作
const fs = require('node:fs')
const path = require('node:path')
const rootPath = path.join(__dirname, '../')
const patchs = [
[
path.join(rootPath, './node_modules/ws/package.json'),
'\n "browser": "./browser.js",',
'',
],
[
path.join(rootPath, './node_modules/music-metadata/package.json'),
'"default": "./lib/core.js"',
'"default": "./lib/index.js"',
],
[
path.join(rootPath, './node_modules/strtok3/package.json'),
'"default": "./lib/core.js"',
'"default": "./lib/index.js"',
],
]
;(async() => {
for (const [filePath, fromStr, toStr] of patchs) {
console.log(`Patching ${filePath.replace(rootPath, '')}`)
try {
const file = (await fs.promises.readFile(filePath)).toString()
await fs.promises.writeFile(filePath, file.replace(fromStr, toStr))
} catch (err) {
console.error(`Patch ${filePath.replace(rootPath, '')} failed: ${err.message}`)
}
}
console.log('\nDependencies patch finished.\n')
})()

View File

@@ -0,0 +1,53 @@
const fs = require('fs')
const path = require('path')
const tar = require('tar')
const libDir = path.join(__dirname, 'lib')
const getGzipFiles = async() => {
const names = await fs.promises.readdir(libDir)
for (const name of names) {
if (name.endsWith('.node')) await fs.promises.unlink(path.join(libDir, name))
}
return names.filter(name => name.endsWith('.gz'))
}
const unzip = async(filePath) => {
const targetDir = filePath.replace('.tar.gz', '')
if (fs.existsSync(targetDir)) await fs.promises.rm(targetDir, { recursive: true })
await fs.promises.mkdir(targetDir)
await tar.x({
file: filePath,
strip: 1,
C: targetDir,
})
return targetDir
}
const files = [
'qrc_decode',
'better_sqlite3',
]
const moveFile = async(filePath) => {
const name = 'electron-' + path.basename(filePath).split('-electron-')[1]
for (const fileName of files) {
if (fileName == 'better_sqlite3' && !name.includes('linux')) continue
const targetPath = path.join(libDir, `${fileName}_${name}.node`)
if (fs.existsSync(targetPath)) await fs.promises.unlink(targetPath)
await fs.promises.rename(path.join(filePath, 'Release', fileName + '.node'), targetPath)
}
await fs.promises.rm(filePath, { recursive: true })
}
const run = async() => {
const files = await getGzipFiles()
for (const name of files) {
await moveFile(await unzip(path.join(libDir, name)))
}
for (const name of files) {
await fs.promises.unlink(path.join(libDir, name))
}
}
run()

View File

@@ -15,6 +15,7 @@ module.exports = {
externals: {
'font-list': 'font-list',
'better-sqlite3': 'better-sqlite3',
'electron-font-manager': 'electron-font-manager',
bufferutil: 'bufferutil',
'utf-8-validate': 'utf-8-validate',
'qrc_decode.node': isDev ? path.join(__dirname, '../../build/Release/qrc_decode.node') : path.join('../build/Release/qrc_decode.node'),

View File

@@ -17,6 +17,7 @@ const { Worker, isMainThread, parentPort } = require('worker_threads')
function build() {
console.time('build')
del.sync(['dist/**', 'build/**'])
const spinners = new Spinnies({ color: 'blue' })
@@ -36,6 +37,7 @@ function build() {
process.stdout.write('\x1B[2J\x1B[0f')
console.log(`\n\n${results}`)
console.log(`${okayLog}take it away ${chalk.yellow('`electron-builder`')}\n`)
console.timeEnd('build')
process.exit()
}

View File

@@ -20,26 +20,21 @@ module.exports = {
type: 'commonjs2',
},
path: path.join(__dirname, '../../dist'),
publicPath: 'auto',
publicPath: '',
},
resolve: {
alias: {
'@': path.join(__dirname, '../../src'),
'@root': path.join(__dirname, '../../src'),
'@main': path.join(__dirname, '../../src/main'),
'@renderer': path.join(__dirname, '../../src/renderer'),
'@lyric': path.join(__dirname, '../../src/renderer-lyric'),
'@static': path.join(__dirname, '../../src/static'),
'@common': path.join(__dirname, '../../src/common'),
},
extensions: ['.tsx', '.ts', '.js', '.json', '.vue', '.node'],
extensions: ['.tsx', '.ts', '.js', '.json', '.node'],
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
exclude: /node_modules/,

View File

@@ -19,6 +19,15 @@ module.exports = merge(baseConfig, {
externals: [
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
],
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {

View File

@@ -12,26 +12,21 @@ module.exports = {
type: 'commonjs2',
},
path: path.join(__dirname, '../../dist'),
publicPath: 'auto',
publicPath: '',
},
resolve: {
alias: {
'@': path.join(__dirname, '../../src'),
'@root': path.join(__dirname, '../../src'),
'@main': path.join(__dirname, '../../src/main'),
'@renderer': path.join(__dirname, '../../src/renderer'),
'@lyric': path.join(__dirname, '../../src/renderer-lyric'),
'@static': path.join(__dirname, '../../src/static'),
'@common': path.join(__dirname, '../../src/common'),
},
extensions: ['.tsx', '.ts', '.js', '.json', '.vue', '.node'],
extensions: ['.tsx', '.ts', '.js', '.json', '.node'],
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
exclude: /node_modules/,

View File

@@ -18,6 +18,15 @@ module.exports = merge(baseConfig, {
externals: [
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
],
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {

View File

@@ -20,26 +20,21 @@ module.exports = {
type: 'commonjs2',
},
path: path.join(__dirname, '../../dist'),
publicPath: 'auto',
publicPath: '',
},
resolve: {
alias: {
'@': path.join(__dirname, '../../src'),
'@root': path.join(__dirname, '../../src'),
'@main': path.join(__dirname, '../../src/main'),
'@renderer': path.join(__dirname, '../../src/renderer'),
'@lyric': path.join(__dirname, '../../src/renderer-lyric'),
'@static': path.join(__dirname, '../../src/static'),
'@common': path.join(__dirname, '../../src/common'),
},
extensions: ['.tsx', '.ts', '.js', '.json', '.vue', '.node'],
extensions: ['.tsx', '.ts', '.js', '.json', '.node'],
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
@@ -49,6 +44,12 @@ module.exports = {
appendTsSuffixTo: [/\.vue$/],
},
},
parser: {
worker: [
'*audioContext.audioWorklet.addModule()',
'...',
],
},
},
{
test: /\.node$/,

View File

@@ -19,6 +19,15 @@ module.exports = merge(baseConfig, {
externals: [
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
],
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [

View File

@@ -9,5 +9,10 @@
"@common/*": ["src/common/*"],
}
},
"vueCompilerOptions": {
"plugins": [
"@vue/language-plugin-pug"
]
},
"exclude": ["node_modules", "build", "dist"]
}

9729
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,74 +1,70 @@
{
"name": "lx-music-desktop",
"version": "2.3.0-beta.3",
"version": "2.5.0",
"description": "一个免费的音乐查找助手",
"main": "./dist/main.js",
"productName": "lx-music-desktop",
"scripts": {
"pack": "node build-config/pack.js && npm run pack:win:setup:x64",
"pack:win": "node build-config/pack.js && npm run pack:win:setup:x64 && npm run pack:win:setup:x86 && npm run pack:win:setup:arm64 && npm run pack:win:setup:x86_64 && npm run pack:win:7z",
"pack:win:setup:x86_64": "cross-env TARGET=Setup ARCH=x86_64 electron-builder -w=nsis --x64 --ia32 -p never",
"pack:win:setup:x64": "cross-env TARGET=Setup ARCH=x64 electron-builder -w=nsis --x64 -p never",
"pack:win:setup:x86": "cross-env TARGET=Setup ARCH=x86 electron-builder -w=nsis --ia32 -p never",
"pack:win:setup:arm64": "cross-env TARGET=Setup ARCH=arm64 electron-builder -w=nsis --arm64 -p never",
"pack:win:setup:x86_64": "node build-config/build-pack.js target=win arch=x86_64 type=setup",
"pack:win:setup:x64": "node build-config/build-pack.js target=win arch=x64 type=setup",
"pack:win:setup:x86": "node build-config/build-pack.js target=win arch=x86 type=setup",
"pack:win:setup:arm64": "node build-config/build-pack.js target=win arch=arm64 type=setup",
"pack:win:portable": "npm run pack:win:portable:x86_64 && npm run pack:win:portable:x64 && npm run pack:win:portable:x86",
"pack:win:portable:x86_64": "cross-env TARGET=portable ARCH=x86_64 electron-builder -w=portable --x64 --ia32 -p never",
"pack:win:portable:x64": "cross-env TARGET=portable ARCH=x64 electron-builder -w=portable --x64 -p never",
"pack:win:portable:x86": "cross-env TARGET=portable ARCH=x86 electron-builder -w=portable --ia32 -p never",
"pack:win:7z": "npm run pack:win:7z:x64 && npm run pack:win:7z:x86",
"pack:win:7z:x64": "cross-env TARGET=green ARCH=win_x64 electron-builder -w=7z --x64 -p never",
"pack:win:7z:x86": "cross-env TARGET=green ARCH=win_x86 electron-builder -w=7z --ia32 -p never",
"pack:win:7z:arm64": "cross-env TARGET=green ARCH=win_arm64 electron-builder -w=7z --arm64 -p never",
"pack:win:portable:x86_64": "node build-config/build-pack.js target=win arch=x86_64 type=portable",
"pack:win:portable:x64": "node build-config/build-pack.js target=win arch=x64 type=portable",
"pack:win:portable:x86": "node build-config/build-pack.js target=win arch=x86 type=portable",
"pack:win:7z": "npm run pack:win:7z:x64",
"pack:win:7z:x64": "node build-config/build-pack.js target=win arch=x64 type=green",
"pack:win:7z:arm64": "node build-config/build-pack.js target=win arch=arm64 type=green",
"pack:win7:7z:x64": "node build-config/build-pack.js target=win arch=x64 type=win7_green",
"pack:win7:7z:x86": "node build-config/build-pack.js target=win arch=x86 type=win7_green",
"pack:linux": "node build-config/pack.js && npm run pack:linux:deb && npm run pack:linux:appImage && npm run pack:linux:rpm && npm run pack:linux:pacman",
"pack:linux:appImage": "cross-env ARCH=x64 electron-builder -l=AppImage -p never",
"pack:linux:deb": "npm run pack:linux:deb:x64 && npm run pack:linux:deb:arm64 && npm run pack:linux:deb:armv7l",
"pack:linux:deb:x64": "cross-env ARCH=x64 electron-builder -l=deb --x64 -p never",
"pack:linux:deb:arm64": "cross-env ARCH=arm64 electron-builder -l=deb --arm64 -p never",
"pack:linux:deb:armv7l": "cross-env ARCH=armv7l electron-builder -l=deb --armv7l -p never",
"pack:linux:rpm": "cross-env ARCH=x64 electron-builder -l=rpm --x64 -p never",
"pack:linux:pacman": "cross-env ARCH=x64 electron-builder -l=pacman --x64 -p never",
"pack:linux:appImage": "node build-config/build-pack.js target=linux arch=x64 type=appImage",
"pack:linux:deb": "npm run pack:linux:deb:amd64 && npm run pack:linux:deb:arm64 && npm run pack:linux:deb:armv7l",
"pack:linux:deb:amd64": "node build-config/build-pack.js target=linux arch=x64 type=deb",
"pack:linux:deb:arm64": "node build-config/build-pack.js target=linux arch=arm64 type=deb",
"pack:linux:deb:armv7l": "node build-config/build-pack.js target=linux arch=armv7l type=deb",
"pack:linux:rpm": "node build-config/build-pack.js target=linux arch=x64 type=rpm",
"pack:linux:pacman": "node build-config/build-pack.js target=linux arch=x64 type=pacman",
"pack:mac": "node build-config/pack.js && npm run pack:mac:dmg && npm run pack:mac:dmg:arm64",
"pack:mac:dmg": "cross-env electron-builder -m=dmg -p never",
"pack:mac:dmg:arm64": "cross-env electron-builder -m=dmg --arm64 -p never",
"pack:dir": "node build-config/pack.js && electron-builder --dir",
"pack:mac:dmg": "node build-config/build-pack.js target=mac arch=x64 type=dmg",
"pack:mac:dmg:arm64": "node build-config/build-pack.js target=mac arch=arm64 type=dmg",
"pack:dir": "node build-config/pack.js && node build-config/build-pack.js target=dir",
"publish": "node publish",
"publish:win:setup:x64:always": "cross-env TARGET=Setup ARCH=x64 electron-builder -w=nsis --x64 -p always",
"publish:win:setup:x64": "cross-env TARGET=Setup ARCH=x64 electron-builder -w=nsis --x64 -p always",
"publish:win:setup:x86": "cross-env TARGET=Setup ARCH=x86 electron-builder -w=nsis --ia32 -p onTagOrDraft",
"publish:win:setup:arm64": "cross-env TARGET=Setup ARCH=arm64 electron-builder -w=nsis --arm64 -p onTagOrDraft",
"publish:win:setup:x86_64": "cross-env TARGET=Setup ARCH=x86_64 electron-builder -w=nsis --x64 --ia32 -p onTagOrDraft",
"publish:win:setup:x64": "node build-config/build-pack.js target=win arch=x64 type=setup publish=always",
"publish:win:setup:x86": "node build-config/build-pack.js target=win arch=x86 type=setup publish=always",
"publish:win:setup:arm64": "node build-config/build-pack.js target=win arch=arm64 type=setup publish=always",
"publish:win:setup:x86_64": "node build-config/build-pack.js target=win arch=x86_64 type=setup publish=always",
"publish:win:portable": "npm run publish:win:portable:x86_64 && npm run publish:win:portable:x64 && npm run publish:win:portable:x86",
"publish:win:portable:x86_64": "cross-env TARGET=portable ARCH=x86_64 electron-builder -w=portable --x64 --ia32 -p onTagOrDraft",
"publish:win:portable:x64": "cross-env TARGET=portable ARCH=x64 electron-builder -w=portable --x64 -p onTagOrDraft",
"publish:win:portable:x86": "cross-env TARGET=portable ARCH=x86 electron-builder -w=portable --ia32 -p onTagOrDraft",
"publish:win:7z:x64": "cross-env TARGET=green ARCH=win_x64 electron-builder -w=7z --x64 -p onTagOrDraft",
"publish:win:7z:x86": "cross-env TARGET=green ARCH=win_x86 electron-builder -w=7z --ia32 -p onTagOrDraft",
"publish:win:7z:arm64": "cross-env TARGET=green ARCH=win_arm64 electron-builder -w=7z --arm64 -p onTagOrDraft",
"publish:mac:dmg:always": "electron-builder -m=dmg -p always",
"publish:mac:dmg": "electron-builder -m=dmg -p onTagOrDraft",
"publish:mac:dmg:arm64": "electron-builder -m=dmg --arm64 -p onTagOrDraft",
"publish:linux:deb:x64:always": "cross-env ARCH=x64 electron-builder -l=deb --x64 -p always",
"publish:linux:deb:x64": "cross-env ARCH=x64 electron-builder -l=deb --x64 -p onTagOrDraft",
"publish:linux:deb:arm64": "cross-env ARCH=arm64 electron-builder -l=deb --arm64 -p onTagOrDraft",
"publish:linux:deb:armv7l": "cross-env ARCH=armv7l electron-builder -l=deb --armv7l -p onTagOrDraft",
"publish:linux:appImage": "cross-env ARCH=x64 electron-builder -l=AppImage -p onTagOrDraft",
"publish:linux:rpm": "cross-env ARCH=x64 electron-builder -l=rpm --x64 -p onTagOrDraft",
"publish:linux:pacman": "cross-env ARCH=x64 electron-builder -l=pacman --x64 -p onTagOrDraft",
"publish:win:portable:x86_64": "node build-config/build-pack.js target=win arch=x86_64 type=portable publish=always",
"publish:win:portable:x64": "node build-config/build-pack.js target=win arch=x64 type=portable publish=always",
"publish:win:portable:x86": "node build-config/build-pack.js target=win arch=x86 type=portable publish=always",
"publish:win:7z:x64": "node build-config/build-pack.js target=win arch=x64 type=green publish=always",
"publish:win:7z:arm64": "node build-config/build-pack.js target=win arch=arm64 type=green publish=always",
"publish:win7:7z:x64": "node build-config/build-pack.js target=win arch=x64 type=win7_green publish=always",
"publish:win7:7z:x86": "node build-config/build-pack.js target=win arch=x86 type=win7_green publish=always",
"publish:mac:dmg": "node build-config/build-pack.js target=mac arch=x64 type=dmg publish=always",
"publish:mac:dmg:arm64": "node build-config/build-pack.js target=mac arch=arm64 type=dmg publish=always",
"publish:linux:deb:amd64": "node build-config/build-pack.js target=linux arch=x64 type=deb publish=always",
"publish:linux:deb:arm64": "node build-config/build-pack.js target=linux arch=arm64 type=deb publish=always",
"publish:linux:deb:armv7l": "node build-config/build-pack.js target=linux arch=armv7l type=deb publish=always",
"publish:linux:appImage": "node build-config/build-pack.js target=linux arch=x64 type=appImage publish=always",
"publish:linux:rpm": "node build-config/build-pack.js target=linux arch=x64 type=rpm publish=always",
"publish:linux:pacman": "node build-config/build-pack.js target=linux arch=x64 type=pacman publish=always",
"dev": "cross-env NODE_OPTIONS=--max-http-header-size=200000 node build-config/runner-dev.js",
"clean:electron": "rimraf dist",
"clean": "rimraf dist && rimraf build",
"build:theme": "node src/common/theme/createThemes.js",
"build:src": "node build-config/pack.js",
"build": "node build-config/pack.js",
"build:main": "cross-env NODE_ENV=production webpack --config build-config/main/webpack.config.prod.js --progress",
"build:renderer": "cross-env NODE_ENV=production webpack --config build-config/renderer/webpack.config.prod.js --progress",
"build:renderer-lyric": "cross-env NODE_ENV=production webpack --config build-config/renderer-lyric/webpack.config.prod.js --progress",
"build:renderer-scripts": "cross-env NODE_ENV=production webpack --config build-config/renderer-scripts/webpack.config.prod.js --progress",
"build": "npm run clean:electron && npm run build:main && npm run build:renderer && npm run build:renderer-lyric && npm run build:renderer-scripts",
"lint": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly src",
"lint:fix": "eslint --ext .ts,.js,.vue -f node_modules/eslint-formatter-friendly --fix src",
"postinstall": "electron-builder install-app-deps",
"dp": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:1081 npm run pack",
"up": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:1081 npm i"
"dp": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm run pack",
"up": "cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:2081 npm i"
},
"browserslist": [
"Electron 22.3.0"
@@ -77,101 +73,6 @@
"node": ">= 16",
"npm": ">=8.5.2"
},
"build": {
"appId": "cn.toside.music.desktop",
"beforePack": "./build-config/build-before-pack.js",
"afterPack": "./build-config/build-after-pack.js",
"protocols": {
"name": "lx-music-protocol",
"schemes": [
"lxmusic"
]
},
"directories": {
"buildResources": "./resources",
"output": "./build"
},
"files": [
"!node_modules/**/*",
"node_modules/font-list",
"node_modules/better-sqlite3/lib",
"node_modules/better-sqlite3/package.json",
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
"node_modules/node-gyp-build",
"node_modules/bufferutil",
"node_modules/utf-8-validate",
"build/Release/qrc_decode.node",
"dist/**/*"
],
"asar": {
"smartUnpack": false
},
"extraResources": [
"./licenses"
],
"win": {
"icon": "./resources/icons/icon.ico",
"legalTrademarks": "lyswhut",
"artifactName": "${productName} v${version} ${env.ARCH} ${env.TARGET}.${ext}"
},
"mac": {
"icon": "./resources/icons/icon.icns",
"category": "public.app-category.music"
},
"linux": {
"maintainer": "lyswhut <lyswhut@qq.com>",
"artifactName": "${productName} v${version} ${env.ARCH}.${ext}",
"icon": "./resources/icons",
"category": "Utility;AudioVideo;Audio;Player;Music;",
"desktop": {
"Name": "LX Music",
"Name[zh_CN]": "LX Music",
"Name[zh_TW]": "LX Music",
"Encoding": "UTF-8",
"MimeType": "x-scheme-handler/lxmusic",
"StartupNotify": "false"
}
},
"nsis": {
"oneClick": false,
"language": "2052",
"allowToChangeInstallationDirectory": true,
"differentialPackage": true,
"license": "./licenses/license.rtf",
"shortcutName": "LX Music"
},
"dmg": {
"window": {
"width": 600,
"height": 400
},
"contents": [
{
"x": 106,
"y": 252,
"name": "LX Music"
},
{
"x": 490,
"y": 252,
"type": "link",
"path": "/Applications"
}
],
"title": "洛雪音乐助手 v${version}"
},
"appImage": {
"license": "./licenses/license_zh.txt",
"category": "Utility;AudioVideo;Audio;Player;Music;"
},
"publish": [
{
"provider": "github",
"owner": "lyswhut",
"repo": "lx-music-desktop"
}
]
},
"macLanguagesInfoPlistStrings": {
"en": {
"CFBundleDisplayName": "LX Music",
@@ -205,101 +106,103 @@
},
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/eslint-parser": "^7.21.8",
"@babel/core": "^7.23.0",
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-umd": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.21.4",
"@babel/preset-env": "^7.21.5",
"@babel/preset-typescript": "^7.21.5",
"@types/better-sqlite3": "^7.6.4",
"@types/needle": "^3.2.0",
"@types/tunnel": "^0.0.3",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@volar/vue-language-plugin-pug": "^1.6.4",
"babel-loader": "^9.1.2",
"browserslist": "^4.21.5",
"@babel/plugin-transform-modules-umd": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/preset-env": "^7.22.20",
"@babel/preset-typescript": "^7.23.0",
"@tsconfig/recommended": "^1.0.3",
"@types/better-sqlite3": "^7.6.5",
"@types/needle": "^3.2.1",
"@types/tunnel": "^0.0.4",
"@types/ws": "8.5.4",
"@volar/vue-language-plugin-pug": "^1.6.5",
"@vue/language-plugin-pug": "^1.8.15",
"babel-loader": "^9.1.3",
"browserslist": "^4.22.0",
"chalk": "^4.1.2",
"changelog-parser": "^3.0.1",
"copy-webpack-plugin": "^11.0.0",
"core-js": "^3.30.2",
"core-js": "^3.32.2",
"cross-env": "^7.0.3",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",
"css-loader": "^6.8.1",
"css-minimizer-webpack-plugin": "^5.0.1",
"del": "^6.1.1",
"electron": "^22.3.8",
"electron-builder": "^24.3.0",
"electron": "^25.8.3",
"electron-builder": "^24.7.0",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.4.385",
"electron-updater": "^6.1.0",
"eslint": "^8.40.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"electron-to-chromium": "^1.4.532",
"electron-updater": "^6.1.5",
"eslint": "^8.50.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^39.1.0",
"eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.11.1",
"eslint-plugin-vue": "^9.17.0",
"eslint-plugin-vue-pug": "^0.6.0",
"eslint-webpack-plugin": "^4.0.1",
"html-webpack-plugin": "^5.5.1",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mini-css-extract-plugin": "^2.7.5",
"html-webpack-plugin": "^5.5.3",
"less": "^4.2.0",
"less-loader": "^11.1.3",
"mini-css-extract-plugin": "^2.7.6",
"node-loader": "^2.0.0",
"postcss": "^8.4.23",
"postcss-loader": "^7.3.0",
"postcss": "^8.4.30",
"postcss-loader": "^7.3.3",
"postcss-pxtorem": "^6.0.0",
"pug": "^3.0.2",
"pug-plain-loader": "^1.1.0",
"rimraf": "^5.0.0",
"rimraf": "^5.0.5",
"spinnies": "github:lyswhut/spinnies#233305c58694aa3b053e3ab9af9049993f918b9d",
"svg-sprite-loader": "^6.0.11",
"svg-transform-loader": "^2.0.13",
"svgo-loader": "^4.0.0",
"terser": "^5.17.1",
"terser-webpack-plugin": "^5.3.8",
"ts-loader": "^9.4.2",
"typescript": "^5.0.4",
"vue-eslint-parser": "^9.2.1",
"vue-loader": "^17.1.0",
"terser": "^5.20.0",
"terser-webpack-plugin": "^5.3.9",
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"vue-eslint-parser": "^9.3.1",
"vue-loader": "^17.2.2",
"vue-template-compiler": "^2.7.14",
"webpack": "^5.82.0",
"webpack-cli": "^5.1.0",
"webpack-dev-server": "^4.15.0",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"webpack-hot-middleware": "github:lyswhut/webpack-hot-middleware#329c4375134b89d39da23a56a94db651247c74a1",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.9.0"
},
"dependencies": {
"@simonwep/pickr": "^1.8.2",
"better-sqlite3": "^8.3.0",
"better-sqlite3": "^8.6.0",
"bufferutil": "^4.0.7",
"comlink": "~4.3.1",
"crypto-js": "^4.1.1",
"electron-log": "^4.4.8",
"electron-font-manager": "github:lyswhut/electron-font-manager#6d2f5ecf850c4fe34812b9394913680462ee0dae",
"electron-log": "^5.0.0-rc.1",
"electron-store": "^8.1.0",
"font-list": "^1.4.5",
"font-list": "^1.5.1",
"iconv-lite": "^0.6.3",
"image-size": "^1.0.2",
"jschardet": "^3.0.0",
"long": "^5.2.3",
"message2call": "^0.1.3",
"music-metadata": "^8.1.4",
"needle": "github:lyswhut/needle#93299ac841b7e9a9f82ca7279b88aaaeda404060",
"node-id3": "^0.2.6",
"sortablejs": "^1.15.0",
"tunnel": "^0.0.6",
"utf-8-validate": "^6.0.3",
"vue": "^3.2.47",
"vue-router": "^4.1.6",
"ws": "^8.13.0"
"vue": "~3.2.47",
"vue-router": "^4.2.5",
"ws": "^8.14.2"
},
"overrides": {
"got": "^11",
"json5": "latest",
"minimatch": "latest",
"semver": "latest",
"svg-sprite-loader": {
"postcss": "latest"
},

View File

@@ -1,7 +1,25 @@
落雪提前祝大家中秋快乐~🥮😘!
### 不兼容性变更
- 由于微软及Electron即将结束对 Windows 7、Windows 8 的支持所以从这个版本起LX的默认 Windows 版也不再支持这些版本的系统,但考虑到仍然有许多人使用 Windows 7我们特别构建了能在 Windows 7 上使用的免安装版文件名带win7需要注意的是这个版本将缺乏安全更新若非必要情况不要使用该版本
- 由于微软在 Windows 10 2004版本已删除对32位的OEM支持所以在这个版本起LX的默认 Windows 版已不再提供32位的支持
- 更改构建的文件名格式主要修改linux下deb、rpm文件命名格式
### 新增
- 新增音效设置实验性功能支持10段均衡器设置、内置的一些环境混响音效、3D立体环绕音效
- 新增Scheme URL对播放器的控制操作新增的操作包含 播放、暂停、下一首、上一首等详情看Scheme URL文档
### 优化
- 通过歌曲菜单添加不喜欢歌曲时需要二次确认防止手抖
### 修复
- 修复音频输出设备设置在重启软件后被重置的问题(#1568
- 修复更换语言设置后源名称未更新的问题
- 修复点击搜索、排行榜等在线列表歌曲右键菜单歌曲详情页会意外将该歌曲添加不喜欢的问题
### 其他
- 更新 electron 到 v22.3.8
- 更新 electron 到 v25.8.3

File diff suppressed because one or more lines are too long

15
src/common/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,15 @@
/* eslint-env node */
const { base, typescript } = require('../../.eslintrc.base.cjs')
module.exports = {
root: true,
...base,
overrides: [
{
...typescript,
parserOptions: {
project: './tsconfig.json',
},
},
],
}

View File

@@ -1,5 +1,9 @@
export const URL_SCHEME_RXP = /^lxmusic:\/\//
export const SPLIT_CHAR = {
DISLIKE_NAME: '@',
DISLIKE_NAME_ALIAS: '#',
} as const
export const STORE_NAMES = {
APP_SETTINGS: 'config_v2',
@@ -50,8 +54,8 @@ export const DEFAULT_SETTING = {
},
songList: {
source: 'kg',
sortId: '5',
source: 'kw',
sortId: 'new',
tagId: '',
},
@@ -76,24 +80,3 @@ export const DOWNLOAD_STATUS = {
} as const
export const QUALITYS = ['flac24bit', 'flac', 'wav', 'ape', '320k', '192k', '128k'] as const
export const SYNC_CODE = {
helloMsg: 'Hello~::^-^::~v3~',
idPrefix: 'OjppZDo6',
authMsg: 'lx-music auth::',
authFailed: 'Auth failed',
missingAuthCode: 'Missing auth code',
getServiceIdFailed: 'Get service id failed',
connectServiceFailed: 'Connect service failed',
connecting: 'Connecting...',
unknownServiceAddress: 'Unknown service address',
msgBlockedIp: 'Blocked IP',
msgConnect: 'lx-music connect',
msgAuthFailed: 'Auth failed',
} as const
export const SYNC_CLOSE_CODE = {
normal: 1000,
failed: 4100,
} as const

View File

@@ -0,0 +1,74 @@
export const ENV_PARAMS = [
'PORT',
'BIND_IP',
'CONFIG_PATH',
'LOG_PATH',
'DATA_PATH',
'PROXY_HEADER',
'MAX_SNAPSHOT_NUM',
'LIST_ADD_MUSIC_LOCATION_TYPE',
'LX_USER_',
] as const
export const LIST_IDS = {
DEFAULT: 'default',
LOVE: 'love',
TEMP: 'temp',
DOWNLOAD: 'download',
PLAY_LATER: null,
} as const
export const SYNC_CODE = {
helloMsg: 'Hello~::^-^::~v4~',
idPrefix: 'OjppZDo6',
authMsg: 'lx-music auth::',
msgAuthFailed: 'Auth failed',
msgBlockedIp: 'Blocked IP',
msgConnect: 'lx-music connect',
authFailed: 'Auth failed',
missingAuthCode: 'Missing auth code',
getServiceIdFailed: 'Get service id failed',
connectServiceFailed: 'Connect service failed',
connecting: 'Connecting...',
unknownServiceAddress: 'Unknown service address',
} as const
export const SYNC_CLOSE_CODE = {
normal: 1000,
failed: 4100,
} as const
export const TRANS_MODE: Readonly<Record<LX.Sync.List.SyncMode, LX.Sync.List.SyncMode>> = {
merge_local_remote: 'merge_remote_local',
merge_remote_local: 'merge_local_remote',
overwrite_local_remote: 'overwrite_remote_local',
overwrite_remote_local: 'overwrite_local_remote',
overwrite_local_remote_full: 'overwrite_remote_local_full',
overwrite_remote_local_full: 'overwrite_local_remote_full',
cancel: 'cancel',
} as const
export const File = {
serverDataPath: 'sync/server',
clientDataPath: 'sync/client',
serverInfoJSON: 'serverInfo.json',
userDir: 'users',
userDevicesJSON: 'devices.json',
listDir: 'list',
listSnapshotDir: 'snapshot',
listSnapshotInfoJSON: 'snapshotInfo.json',
dislikeDir: 'dislike',
dislikeSnapshotDir: 'snapshot',
dislikeSnapshotInfoJSON: 'snapshotInfo.json',
syncAuthKeysJSON: 'syncAuthKey.json',
} as const
export const FeaturesList = [
'list',
'dislike',
] as const

View File

@@ -1,5 +1,5 @@
import { join } from 'path'
import { homedir } from 'os'
import path from 'node:path'
import os from 'node:os'
const isMac = process.platform == 'darwin'
const isWin = process.platform == 'win32'
@@ -29,6 +29,7 @@ const defaultSetting: LX.AppSetting = {
'player.volume': 1,
'player.isMute': false,
'player.playbackRate': 1,
'player.preservesPitch': true,
'player.mediaDeviceId': 'default',
'player.isMediaDeviceRemovedStopPlay': false,
'player.isShowLyricTranslation': false,
@@ -40,6 +41,7 @@ const defaultSetting: LX.AppSetting = {
'player.waitPlayEndStop': true,
'player.waitPlayEndStopTime': '',
'player.autoSkipOnError': true,
'player.isAutoCleanPlayedList': false,
'player.soundEffect.convolution.fileName': '',
'player.soundEffect.convolution.mainGain': 10,
'player.soundEffect.convolution.sendGain': 0,
@@ -56,6 +58,7 @@ const defaultSetting: LX.AppSetting = {
'player.soundEffect.panner.enable': false,
'player.soundEffect.panner.soundR': 5,
'player.soundEffect.panner.speed': 25,
'player.soundEffect.pitchShifter.playbackRate': 1,
'playDetail.isZoomActiveLrc': false,
'playDetail.isShowLyricProgressSetting': false,
@@ -73,7 +76,7 @@ const defaultSetting: LX.AppSetting = {
'desktopLyric.height': 300,
'desktopLyric.x': null,
'desktopLyric.y': null,
'desktopLyric.isLockScreen': true,
'desktopLyric.isLockScreen': isWin,
'desktopLyric.isDelayScroll': true,
'desktopLyric.scrollAlign': 'center',
'desktopLyric.isHoverHide': false,
@@ -100,7 +103,7 @@ const defaultSetting: LX.AppSetting = {
'list.actionButtonsVisible': false,
'download.enable': false,
'download.savePath': join(homedir(), 'Desktop'),
'download.savePath': path.join(os.homedir(), 'Desktop'),
'download.fileName': '歌名 - 歌手',
'download.maxDownloadNum': 3,
'download.skipExistFile': true,
@@ -134,8 +137,8 @@ const defaultSetting: LX.AppSetting = {
'sync.server.maxSsnapshotNum': 5,
'sync.client.host': '',
'theme.id': 'blue_plus',
// 'theme.id': 'green',
// 'theme.id': 'blue_plus',
'theme.id': 'green',
'theme.lightId': 'green',
'theme.darkId': 'black',

View File

@@ -6,7 +6,7 @@ const ignoreErrorMessage = [
]
process.on('uncaughtException', err => {
if (ignoreErrorMessage.includes(err.message)) return
if (ignoreErrorMessage.includes(err?.message)) return
console.error('An uncaught error occurred!')
console.error(err)
log.error(err)

View File

@@ -66,6 +66,21 @@ const hotKey = {
action: 'volume_mute',
type: '',
},
music_love: {
name: 'music_love',
action: 'music_love',
type: '',
},
music_unlove: {
name: 'music_unlove',
action: 'music_unlove',
type: '',
},
music_dislike: {
name: 'music_dislike',
action: 'music_dislike',
type: '',
},
},
desktop_lyric: {
toggle_visible: {

View File

@@ -36,6 +36,12 @@ const modules = {
list_music_check_exist: 'list_music_check_exist',
list_music_get_list_ids: 'list_music_get_list_ids',
},
dislike: {
get_dislike_music_infos: 'get_dislike_music_infos',
add_dislike_music_infos: 'add_dislike_music_infos',
overwrite_dislike_music_infos: 'overwrite_dislike_music_infos',
clear_dislike_music_infos: 'clear_dislike_music_infos',
},
winMain: {
focus: 'focus',
close: 'close',
@@ -94,6 +100,8 @@ const modules = {
save_sound_effect_eq_preset: 'save_sound_effect_eq_preset',
get_sound_effect_convolution_preset: 'get_sound_effect_convolution_preset',
save_sound_effect_convolution_preset: 'save_sound_effect_convolution_preset',
// get_sound_effect_pitch_shifter_preset: 'get_sound_effect_pitch_shifter_preset',
// save_sound_effect_pitch_shifter_preset: 'save_sound_effect_pitch_shifter_preset',
get_hot_key: 'get_hot_key',
import_user_api: 'import_user_api',
@@ -125,6 +133,8 @@ const modules = {
get_music_url_count: 'get_music_url_count',
sync_action: 'sync_action',
sync_get_server_devices: 'sync_get_server_devices',
sync_remove_server_device: 'sync_remove_server_device',
process_new_desktop_lyric_client: 'process_new_desktop_lyric_client',
@@ -178,6 +188,7 @@ for (const moduleName of Object.keys(modules) as Array<keyof typeof modules>) {
export const CMMON_EVENT_NAME = modules.common
export const PLAYER_EVENT_NAME = modules.player
export const DISLIKE_EVENT_NAME = modules.dislike
export const WIN_MAIN_RENDERER_EVENT_NAME = modules.winMain
export const WIN_LYRIC_RENDERER_EVENT_NAME = modules.winLyric
export const HOTKEY_RENDERER_EVENT_NAME = modules.hotKey

View File

@@ -30,7 +30,7 @@ export function mainHandle<V>(name: string, listener: LX.IpcMainInvokeEventListe
export function mainHandle<T, V>(name: string, listener: LX.IpcMainInvokeEventListenerParamsValue<T, V>): void
export function mainHandle<T, V>(name: string, listener: LX.IpcMainInvokeEventListenerParamsValue<T, V>): void {
ipcMain.handle(name, async(event, params) => {
return await listener({ event, params })
return listener({ event, params })
})
}
@@ -40,7 +40,7 @@ export function mainHandleOnce<V>(name: string, listener: LX.IpcMainInvokeEventL
export function mainHandleOnce<T, V>(name: string, listener: LX.IpcMainInvokeEventListenerParamsValue<T, V>): void
export function mainHandleOnce<T, V>(name: string, listener: LX.IpcMainInvokeEventListenerParamsValue<T, V>): void {
ipcMain.handleOnce(name, async(event, params) => {
return await listener({ event, params })
return listener({ event, params })
})
}
export const mainHandleRemove = (name: string) => {

View File

@@ -17,7 +17,7 @@ export async function rendererInvoke<V>(name: string): Promise<V>
export async function rendererInvoke<T>(name: string, params: T): Promise<void>
export async function rendererInvoke<T, V>(name: string, params: T): Promise<V>
export async function rendererInvoke <T, V>(name: string, params?: T): Promise<V> {
return await ipcRenderer.invoke(name, params)
return ipcRenderer.invoke(name, params)
}
export function rendererOn(name: string, listener: LX.IpcRendererEventListener): void

View File

@@ -8,7 +8,7 @@
* @param {string} c1 rgb(a) color2
* @returns color
*/
exports.RGB_Linear_Blend=(p,c0,c1)=>{
export const RGB_Linear_Blend=(p,c0,c1)=>{
var i=parseInt,r=Math.round,P=1-p,[a,b,c,d]=c0.split(","),[e,f,g,h]=c1.split(","),x=d||h,j=x?","+(!d?h:!h?d:r((parseFloat(d)*P+parseFloat(h)*p)*1000)/1000+")"):")";
return"rgb"+(x?"a(":"(")+r(i(a[3]=="a"?a.slice(5):a.slice(4))*P+i(e[3]=="a"?e.slice(5):e.slice(4))*p)+","+r(i(b)*P+i(f)*p)+","+r(i(c)*P+i(g)*p)+j;
}
@@ -20,7 +20,7 @@ exports.RGB_Linear_Blend=(p,c0,c1)=>{
* @param {string} c1 rgb(a) color2
* @returns color
*/
exports.RGB_Log_Blend=(p,c0,c1)=>{
export const RGB_Log_Blend=(p,c0,c1)=>{
var i=parseInt,r=Math.round,P=1-p,[a,b,c,d]=c0.split(","),[e,f,g,h]=c1.split(","),x=d||h,j=x?","+(!d?h:!h?d:r((parseFloat(d)*P+parseFloat(h)*p)*1000)/1000+")"):")";
return"rgb"+(x?"a(":"(")+r((P*i(a[3]=="a"?a.slice(5):a.slice(4))**2+p*i(e[3]=="a"?e.slice(5):e.slice(4))**2)**0.5)+","+r((P*i(b)**2+p*i(f)**2)**0.5)+","+r((P*i(c)**2+p*i(g)**2)**0.5)+j;
}
@@ -32,7 +32,7 @@ exports.RGB_Log_Blend=(p,c0,c1)=>{
* @param {string} c0 rgb(a) color
* @returns color
*/
exports.RGB_Linear_Shade=(p,c0)=>{
export const RGB_Linear_Shade=(p,c0)=>{
var i=parseInt,r=Math.round,[a,b,c,d]=c0.split(","),n=p<0,t=n?0:255*p,P=n?1+p:1-p;
return"rgb"+(d?"a(":"(")+r(i(a[3]=="a"?a.slice(5):a.slice(4))*P+t)+","+r(i(b)*P+t)+","+r(i(c)*P+t)+(d?","+d:")");
}
@@ -44,7 +44,7 @@ exports.RGB_Linear_Shade=(p,c0)=>{
* @param {string} c0 rgb(a) color
* @returns color
*/
exports.RGB_Log_Shade=(p,c0)=>{
export const RGB_Log_Shade=(p,c0)=>{
var i=parseInt,r=Math.round,[a,b,c,d]=c0.split(","),n=p<0,t=n?0:p*255**2,P=n?1+p:1-p;
return"rgb"+(d?"a(":"(")+r((P*i(a[3]=="a"?a.slice(5):a.slice(4))**2+t)**0.5)+","+r((P*i(b)**2+t)**0.5)+","+r((P*i(c)**2+t)**0.5)+(d?","+d:")");
}
@@ -56,7 +56,7 @@ exports.RGB_Log_Shade=(p,c0)=>{
* @param {string} color
* @returns color
*/
exports.RGB_Alpha_Shade = (p, color) => {
export const RGB_Alpha_Shade = (p, color) => {
var i = parseInt
var n = p < 0
var [r, g, b, a] = color.split(",")

View File

@@ -1,8 +1,8 @@
//! 更新默认主题配置后,需要执行 npm run build:theme 重新构建index.json
const fs = require('fs')
const path = require('path')
const { createThemeColors } = require('./utils')
import fs from 'fs'
import path from 'path'
import { createThemeColors } from './utils'
const defaultThemes = [
{

View File

@@ -1,6 +1,6 @@
const { RGB_Linear_Shade, RGB_Alpha_Shade } = require('./colorUtils')
import { RGB_Linear_Shade, RGB_Alpha_Shade } from './colorUtils'
exports.createThemeColors = (rgbaColor, fontRgbaColor, isDark) => {
export const createThemeColors = (rgbaColor, fontRgbaColor, isDark) => {
const colors = {
'--color-primary': rgbaColor,
}

View File

@@ -1,16 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "nodenext",
"typeRoots": [ /* Specify multiple folders that act like './node_modules/@types'. */
"typeRoots": [
"./types"
],
"paths": { /* Specify a set of entries that re-map imports to additional lookup locations. */
"@common/*": ["common/*"],
},
},
// "include": [
// "**/*.ts",
// "**/*.js",
// "**/*.vue",
// "**/*.json",
// ],
}

View File

@@ -1,4 +1,4 @@
import type { I18n } from '@/lang/i18n'
import type { I18n } from '@root/lang/i18n'
declare global {
@@ -113,6 +113,11 @@ declare global {
*/
'player.playbackRate': number
/**
* 是否自动调整音频的音高以补偿对播放速率设置所做的更改
*/
'player.preservesPitch': boolean
/**
* 音频输出设备id
*/
@@ -243,11 +248,21 @@ declare global {
*/
'player.soundEffect.panner.speed': number
/**
* 升降声调
*/
'player.soundEffect.pitchShifter.playbackRate': number
/**
* 是否启用音频加载失败时自动切歌
*/
'player.autoSkipOnError': boolean
/**
* 点击相同列表内的歌曲切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)
*/
'player.isAutoCleanPlayedList': boolean
/**
* 播放详情页-是否缩放当前播放的歌词行
*/

37
src/common/types/dislike_list.d.ts vendored Normal file
View File

@@ -0,0 +1,37 @@
declare namespace LX {
namespace Dislike {
// interface ListItemMusicText {
// id?: string
// // type: 'music'
// name: string | null
// singer: string | null
// }
// interface ListItemMusic {
// id?: number
// type: 'musicId'
// musicId: string
// meta: LX.Music.MusicInfo
// }
// type ListItem = ListItemMusicText
// type ListItem = string
// type ListItem = ListItemMusic | ListItemMusicText
interface DislikeMusicInfo {
name: string
singer: string
}
type DislikeRules = string
interface DislikeInfo {
// musicIds: Set<string>
names: Set<string>
musicNames: Set<string>
singerNames: Set<string>
// list: LX.Dislike.ListItem[]
rules: DislikeRules
}
}
}

30
src/common/types/dislike_list_sync.d.ts vendored Normal file
View File

@@ -0,0 +1,30 @@
declare namespace LX {
namespace Sync {
namespace Dislike {
interface ListInfo {
lastSyncDate?: number
snapshotKey: string
}
interface SyncActionBase <A> {
action: A
}
interface SyncActionData<A, D> extends SyncActionBase<A> {
data: D
}
type SyncAction<A, D = undefined> = D extends undefined ? SyncActionBase<A> : SyncActionData<A, D>
type ActionList = SyncAction<'dislike_data_overwrite', LX.Dislike.DislikeRules>
| SyncAction<'dislike_music_add', LX.Dislike.DislikeMusicInfo[]>
| SyncAction<'dislike_music_clear'>
type SyncMode = 'merge_local_remote'
| 'merge_remote_local'
| 'overwrite_local_remote'
| 'overwrite_remote_local'
// | 'none'
| 'cancel'
}
}
}

View File

@@ -1,4 +1,4 @@
import { type Message } from '@/lang'
import { type Message } from '@root/lang'
// interface DownloadList {

View File

@@ -139,6 +139,5 @@ declare namespace LX {
userList: UserListInfoFull[]
tempList: LX.Music.MusicInfo[]
}
}
}

34
src/common/types/list_sync.d.ts vendored Normal file
View File

@@ -0,0 +1,34 @@
declare namespace LX {
namespace Sync {
namespace List {
interface ListInfo {
lastSyncDate?: number
snapshotKey: string
}
type ActionList = LX.Sync.SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite>
| SyncAction<'list_create', LX.List.ListActionAdd>
| SyncAction<'list_remove', LX.List.ListActionRemove>
| SyncAction<'list_update', LX.List.ListActionUpdate>
| SyncAction<'list_update_position', LX.List.ListActionUpdatePosition>
| SyncAction<'list_music_add', LX.List.ListActionMusicAdd>
| SyncAction<'list_music_move', LX.List.ListActionMusicMove>
| SyncAction<'list_music_remove', LX.List.ListActionMusicRemove>
| SyncAction<'list_music_update', LX.List.ListActionMusicUpdate>
| SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition>
| SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite>
| SyncAction<'list_music_clear', LX.List.ListActionMusicClear>
type ListData = Omit<LX.List.ListDataFull, 'tempList'>
type SyncMode = 'merge_local_remote'
| 'merge_remote_local'
| 'overwrite_local_remote'
| 'overwrite_remote_local'
| 'overwrite_local_remote_full'
| 'overwrite_remote_local_full'
// | 'none'
| 'cancel'
}
}
}

View File

@@ -21,5 +21,10 @@ declare namespace LX {
mainGain: number
sendGain: number
}
// interface PitchShifterPreset {
// id: string
// name: string
// playbackRate: number
// }
}
}

View File

@@ -19,52 +19,27 @@ declare namespace LX {
}
type SyncAction<A, D = undefined> = D extends undefined ? SyncActionBase<A> : SyncActionData<A, D>
type SyncMainWindowActions = SyncAction<'select_mode', string>
interface ModeTypes {
list: LX.Sync.List.SyncMode
dislike: LX.Sync.Dislike.SyncMode
}
type ModeType = { [K in keyof ModeTypes]: { type: K, mode: ModeTypes[K] } }[keyof ModeTypes]
type SyncMainWindowActions = SyncAction<'select_mode', { deviceName: string, type: keyof ModeTypes }>
| SyncAction<'close_select_mode'>
| SyncAction<'client_status', ClientStatus>
| SyncAction<'server_status', ServerStatus>
type SyncServiceActions = SyncAction<'select_mode', Mode>
type SyncServiceActions = SyncAction<'select_mode', ModeType>
| SyncAction<'get_server_status'>
| SyncAction<'get_client_status'>
| SyncAction<'generate_code'>
| SyncAction<'enable_server', EnableServer>
| SyncAction<'enable_client', EnableClient>
type ActionList = SyncAction<'list_data_overwrite', LX.List.ListActionDataOverwrite>
| SyncAction<'list_create', LX.List.ListActionAdd>
| SyncAction<'list_remove', LX.List.ListActionRemove>
| SyncAction<'list_update', LX.List.ListActionUpdate>
| SyncAction<'list_update_position', LX.List.ListActionUpdatePosition>
| SyncAction<'list_music_add', LX.List.ListActionMusicAdd>
| SyncAction<'list_music_move', LX.List.ListActionMusicMove>
| SyncAction<'list_music_remove', LX.List.ListActionMusicRemove>
| SyncAction<'list_music_update', LX.List.ListActionMusicUpdate>
| SyncAction<'list_music_update_position', LX.List.ListActionMusicUpdatePosition>
| SyncAction<'list_music_overwrite', LX.List.ListActionMusicOverwrite>
| SyncAction<'list_music_clear', LX.List.ListActionMusicClear>
type ActionSync = SyncAction<'list:sync:list_sync_get_md5', string>
| SyncAction<'list:sync:list_sync_get_list_data', ListData>
| SyncAction<'list:sync:list_sync_get_sync_mode', Mode>
| SyncAction<'list:sync:action', ActionList>
// | SyncAction<'finished'>
type ActionSyncType = Actions<ActionSync>
type ActionSyncSend = SyncAction<'list:sync:list_sync_get_md5'>
| SyncAction<'list:sync:list_sync_get_list_data'>
| SyncAction<'list:sync:list_sync_get_sync_mode'>
| SyncAction<'list:sync:list_sync_set_data', LX.Sync.ListData>
| SyncAction<'list:sync:action', ActionList>
| SyncAction<'list:sync:finished'>
type ActionSyncSendType = Actions<ActionSyncSend>
interface List {
action: string
data: any
}
type ServerDevices = ServerKeyInfo[]
interface ServerStatus {
status: boolean
@@ -90,21 +65,21 @@ declare namespace LX {
clientId: string
key: string
deviceName: string
lastSyncDate?: number
snapshotKey: string
lastConnectDate?: number
isMobile: boolean
}
type ListData = Omit<LX.List.ListDataFull, 'tempList'>
type Mode = 'merge_local_remote'
| 'merge_remote_local'
| 'overwrite_local_remote'
| 'overwrite_remote_local'
| 'overwrite_local_remote_full'
| 'overwrite_remote_local_full'
// | 'none'
| 'cancel'
interface ListConfig {
skipSnapshot: boolean
}
interface DislikeConfig {
skipSnapshot: boolean
}
type ServerType = 'desktop-app' | 'server'
interface EnabledFeatures {
list?: false | ListConfig
dislike?: false | DislikeConfig
}
type SupportedFeatures = Partial<{ [k in keyof EnabledFeatures]: number }>
}
}

View File

@@ -10,3 +10,13 @@ type Modify<T, R> = Omit<T, keyof R> & R
type Actions<T extends { action: string, data?: any }> = {
[U in T as U['action']]: 'data' extends keyof U ? U['data'] : undefined
}
type WarpPromiseValue<T> = T extends ((...args: infer P) => Promise<infer R>)
? ((...args: P) => Promise<R>)
: T extends ((...args: infer P2) => infer R2)
? ((...args: P2) => Promise<R2>)
: Promise<T>
type WarpPromiseRecord<T extends Record<string, any>> = {
[K in keyof T]: WarpPromiseValue<T[K]>
}

View File

@@ -225,3 +225,23 @@ export const arrPushByPosition = <T>(list: T[], newList: T[], position: number)
}
return list
}
// https://stackoverflow.com/a/2450976
export const arrShuffle = <T>(array: T[]) => {
let currentIndex = array.length
let randomIndex
// While there remain elements to shuffle.
while (currentIndex != 0) {
// Pick a remaining element.
randomIndex = Math.floor(Math.random() * currentIndex)
currentIndex--;
// And swap it with the current element.
[array[currentIndex], array[randomIndex]] = [
array[randomIndex], array[currentIndex]]
}
return array
}

View File

@@ -37,6 +37,8 @@ class Task extends EventEmitter {
progress = { total: 0, downloaded: 0, speed: 0, progress: 0 }
statsEstimate = { time: 0, bytes: 0, prevBytes: 0 }
requestInstance: http.ClientRequest | null = null
maxRedirectNum = 2
private redirectNum = 0
constructor(url: string, savePath: string, filename: string, options: Partial<Options> = {}) {
@@ -59,6 +61,7 @@ class Task extends EventEmitter {
async __init() {
const { path, startByte, endByte } = this.chunkInfo
this.redirectNum = 0
this.progress.downloaded = 0
this.progress.progress = 0
this.progress.speed = 0
@@ -112,6 +115,7 @@ class Task extends EventEmitter {
__httpFetch(url: string, options: Options['requestOptions']) {
// console.log(options)
let redirected = false
this.requestInstance = request(url, options)
.on('response', response => {
if (response.statusCode !== 200 && response.statusCode !== 206) {
@@ -125,6 +129,15 @@ class Task extends EventEmitter {
})
return
}
if ((response.statusCode == 301 || response.statusCode == 302) && response.headers.location && this.redirectNum < this.maxRedirectNum) {
console.log('current url:', url)
console.log('redirect to:', response.headers.location)
redirected = true
this.redirectNum++
const location = response.headers.location
this.__httpFetch(location, options)
return
}
this.status = STATUS.failed
this.emit('fail', response)
this.__closeRequest()
@@ -153,6 +166,7 @@ class Task extends EventEmitter {
})
.on('error', err => { this.__handleError(err) })
.on('close', () => {
if (redirected) return
void this.__closeWriteStream()
})
.end()
@@ -256,7 +270,7 @@ class Task extends EventEmitter {
const result = this.__handleDiffChunk(chunk)
if (result) chunk = result
else {
this.__handleStop().finally(() => {
void this.__handleStop().finally(() => {
// this.__handleError(new Error('Resume failed, response chunk does not match.'))
// Resume failed, response chunk does not match, remove file and restart download
console.log('Resume failed, response chunk does not match.')

View File

@@ -4,24 +4,24 @@
// -------------------------------------------------------------------------------------------------
// Change the following variables to customize the appearance of the particles
var numParticles = window.innerWidth / 50;
var maxSpeed = 2.5;
var minSpeed = 1;
var maxSize = 5;
var minSize = 3;
var maxOpacity = 1;
var minOpacity = 0.2;
let numParticles = window.innerWidth / 50
let maxSpeed = 2.5
let minSpeed = 1
let maxSize = 5
let minSize = 3
let maxOpacity = 1
let minOpacity = 0.2
// If the following is true, the canvas resolution will be set to match the full viewport width and height.
// var fixCanvasResolution = true;
var snow_particles = [];
let snow_particles = []
var canvas
let canvas
window.onload = function() {
canvas = document.createElement('canvas')
canvas.style.position = 'fixed';
canvas.style.position = 'fixed'
canvas.style.top = '0px'
canvas.style.left = '0px'
canvas.style.pointerEvents = 'none'
@@ -30,62 +30,62 @@ window.onload = function() {
canvas.height = document.documentElement.clientHeight
document.body.appendChild(canvas)
// if (fixCanvasResolution) {
// // canvas.width = window.innerWidth;
// canvas.height = window.innerHeight;
// }
// if (fixCanvasResolution) {
// // canvas.width = window.innerWidth;
// canvas.height = window.innerHeight;
// }
InitPoints();
InitPoints()
requestAnimationFrame(Redraw, 15);
window.requestAnimationFrame(Redraw, 15)
window.addEventListener('resize', this.onWindowResize)
}
function onWindowResize (e) {
canvas.width = document.documentElement.clientWidth
canvas.height = document.documentElement.clientHeight
}
// function onWindowResize(e) {
// canvas.width = document.documentElement.clientWidth
// canvas.height = document.documentElement.clientHeight
// }
function Redraw() {
var ctx = canvas.getContext("2d");
ctx.clearRect(0,0,canvas.width,canvas.height);
for (var i = 0; i < snow_particles.length; i++) {
var newYPos = snow_particles[i].yPos + snow_particles[i].speed;
if (newYPos > window.innerHeight) {
newYPos = getRandomInt(-100,-10);
snow_particles[i].xPos = getRandomInt(0, window.innerWidth);
snow_particles[i].speed = Math.random() * (maxSpeed - minSpeed) + minSpeed;
snow_particles[i].opacity = Math.random() * (maxOpacity - minOpacity) + minOpacity;
snow_particles[i].size = Math.random() * (maxSize - minSize) + minSize;
}
snow_particles[i].yPos = newYPos;
ctx.beginPath();
ctx.arc(snow_particles[i].xPos, newYPos, snow_particles[i].size, 0, 2 * Math.PI);
ctx.fillStyle = "rgba(255, 255, 255, " + snow_particles[i].opacity + ")";
ctx.fill();
}
requestAnimationFrame(Redraw)
let ctx = canvas.getContext('2d')
ctx.clearRect(0, 0, canvas.width, canvas.height)
for (let i = 0; i < snow_particles.length; i++) {
let newYPos = snow_particles[i].yPos + snow_particles[i].speed
if (newYPos > window.innerHeight) {
newYPos = getRandomInt(-100, -10)
snow_particles[i].xPos = getRandomInt(0, window.innerWidth)
snow_particles[i].speed = Math.random() * (maxSpeed - minSpeed) + minSpeed
snow_particles[i].opacity = Math.random() * (maxOpacity - minOpacity) + minOpacity
snow_particles[i].size = Math.random() * (maxSize - minSize) + minSize
}
snow_particles[i].yPos = newYPos
ctx.beginPath()
ctx.arc(snow_particles[i].xPos, newYPos, snow_particles[i].size, 0, 2 * Math.PI)
ctx.fillStyle = 'rgba(255, 255, 255, ' + snow_particles[i].opacity + ')'
ctx.fill()
}
window.requestAnimationFrame(Redraw)
}
function InitPoints() {
for (var i = 0; i < numParticles; i++) {
var startX = getRandomInt(0, window.innerWidth);
var startY = getRandomInt(0, window.innerHeight);
var speed = Math.random() * (maxSpeed - minSpeed) + minSpeed;
var opacity = Math.random() * (maxOpacity - minOpacity) + minOpacity;
var size = Math.random() * (maxSize - minSize) + minSize;
for (let i = 0; i < numParticles; i++) {
let startX = getRandomInt(0, window.innerWidth)
let startY = getRandomInt(0, window.innerHeight)
let speed = Math.random() * (maxSpeed - minSpeed) + minSpeed
let opacity = Math.random() * (maxOpacity - minOpacity) + minOpacity
let size = Math.random() * (maxSize - minSize) + minSize
snow_particles.push({
"xPos": startX,
"yPos": startY,
"speed": speed,
"opacity": opacity,
"size": size,
});
}
snow_particles.push({
xPos: startX,
yPos: startY,
speed,
opacity,
size,
})
}
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min)) + min
}

View File

@@ -39,5 +39,6 @@ export const clipboardReadText = (): string => {
export const encodePath = (path: string) => {
// https://github.com/lyswhut/lx-music-desktop/issues/963
return path.replaceAll('%', '%25')
// https://github.com/lyswhut/lx-music-desktop/issues/1461
return path.replaceAll('%', '%25').replaceAll('#', '%23')
}

View File

@@ -1,6 +1,5 @@
import log from 'electron-log'
log.transports.file.level = 'info'
export const isLinux = process.platform == 'linux'
export const isWin = process.platform == 'win32'

View File

@@ -1,4 +1,4 @@
const { getNow, TimeoutTools } = require('./utils')
import { getNow, TimeoutTools } from './utils'
// const fontFormateRxp = /(?=<\d+,\d+>).*?/g
const fontSplitRxp = /(?=<\d+,\d+>).*?/g
@@ -25,7 +25,7 @@ const createAnimation = (dom, duration, isVertical) => new window.Animation(new
// https://jsfiddle.net/ceqpnbky/
// https://jsfiddle.net/ceqpnbky/1/
module.exports = class FontPlayer {
export default class FontPlayer {
constructor({
time = 0,
rate = 1,
@@ -69,8 +69,8 @@ module.exports = class FontPlayer {
this.lineContent = null
this.timeoutTools = new TimeoutTools(80)
this.waitPlayTimeout = new TimeoutTools(80)
this.timeoutTools = new TimeoutTools(50)
this.waitPlayTimeout = new TimeoutTools(50)
this._init()
}
@@ -133,8 +133,8 @@ module.exports = class FontPlayer {
// let lineText = ''
let lrcShadowContent
for (const font of fonts) {
if (!timeRxp.test(font)) return this._handleLineParse()
text = font.replace(timeRxp, '')
if (RegExp.$2 == '') return this._handleLineParse()
const time = parseInt(RegExp.$2)
const dom = document.createElement('span')

View File

@@ -1,9 +1,9 @@
const LinePlayer = require('./line-player')
const FontPlayer = require('./font-player')
import LinePlayer from './line-player'
import FontPlayer from './font-player'
const fontTimeExp = /<(\d+),(\d+)>/g
module.exports = class Lyric {
export default class Lyric {
constructor({
lyric = '',
extendedLyrics = [],
@@ -68,7 +68,7 @@ module.exports = class Lyric {
_handleLinePlayerOnPlay = (num, text, curTime) => {
if (this.isLineMode) {
if (num < this.playingLineNum + 1) {
for (let i = this.playingLineNum; i > num - 1; i--) {
for (let i = this.playingLineNum, minNum = Math.max(num, 0) - 1; i > minNum; i--) {
const font = this._lineFonts[i]
font.reset()
font.lineContent.classList.remove(this.activeLineClassName)
@@ -86,7 +86,7 @@ module.exports = class Lyric {
}
} else {
if (num < this.playingLineNum + 1) {
for (let i = this.playingLineNum; i > num - 1; i--) {
for (let i = this.playingLineNum, minNum = Math.max(num, 0) - 1; i > minNum; i--) {
const font = this._lineFonts[i]
font.lineContent.classList.remove(this.activeLineClassName)
font.reset()
@@ -103,10 +103,12 @@ module.exports = class Lyric {
}
}
this.playingLineNum = num
const font = this._lineFonts[num]
font.lineContent.classList.add(this.activeLineClassName)
font.play(curTime - this._lines[num].time)
this.onPlay(num, this._lines[num].text)
if (num > -1) {
const font = this._lineFonts[num]
font.lineContent.classList.add(this.activeLineClassName)
font.play(curTime - this._lines[num].time)
}
this.onPlay(num, this._lines[num]?.text ?? '')
}
_initLines = (lyricLines, offset, isUpdate) => {

View File

@@ -1,4 +1,4 @@
const { getNow, TimeoutTools } = require('./utils')
import { getNow, TimeoutTools } from './utils'
const timeFieldExp = /^(?:\[[\d:.]+\])+/g
const timeExp = /\d{1,3}(:\d{1,3}){0,2}(?:\.\d{1,3})/g
@@ -29,7 +29,8 @@ const parseExtendedLyric = (lrcLinesMap, extendedLyric) => {
if (result) {
const timeField = result[0]
const text = line.replace(timeFieldExp, '').trim()
if (text) {
// https://github.com/lyswhut/lx-music-desktop/issues/1499
if (text && text != '//') {
const times = timeField.match(timeExp)
if (times == null) continue
for (let time of times) {
@@ -42,7 +43,7 @@ const parseExtendedLyric = (lrcLinesMap, extendedLyric) => {
}
}
module.exports = class LinePlayer {
export default class LinePlayer {
constructor({ offset = 0, rate = 1, onPlay = function() { }, onSetLyric = function() { } } = {}) {
this.tags = {}
this.lines = null
@@ -147,7 +148,7 @@ module.exports = class LinePlayer {
const currentTime = this._currentTime()
const driftTime = currentTime - curLine.time
if (driftTime >= 0 || this.curLineNum === 0) {
if (driftTime >= 0) {
let nextLine = this.lines[this.curLineNum + 1]
const delay = (nextLine.time - curLine.time - driftTime) / this._rate
@@ -166,6 +167,17 @@ module.exports = class LinePlayer {
this._refresh()
return
}
} else if (this.curLineNum == 0) {
let firstLine = this.lines[0]
const delay = (firstLine.time - currentTime) / this._rate
if (this.isPlay) {
timeoutTools.start(() => {
if (!this.isPlay) return
this._refresh()
}, delay)
}
this.onPlay(-1, '', currentTime)
return
}
this.curLineNum = this._findCurLineNum(currentTime, this.curLineNum) - 1

View File

@@ -1,8 +1,8 @@
const getNow = exports.getNow = typeof performance == 'object' && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date)
export const getNow = typeof performance == 'object' && window.performance.now ? window.performance.now.bind(window.performance) : Date.now.bind(Date)
exports.TimeoutTools = class TimeoutTools {
constructor(thresholdTime = 200) {
export class TimeoutTools {
constructor(thresholdTime = 80) {
this.invokeTime = 0
this.animationFrameId = null
this.timeoutId = null
@@ -17,6 +17,7 @@ exports.TimeoutTools = class TimeoutTools {
// console.log('diff', diff)
if (diff > 0) {
if (diff < this.thresholdTime) return this.run()
// console.log('run timeout', diff, diff - this.thresholdTime)
return this.timeoutId = window.setTimeout(() => {
this.timeoutId = null
this.run()

View File

@@ -1,8 +1,8 @@
import fs from 'fs'
import crypto from 'crypto'
import { gzip, gunzip } from 'zlib'
import fs from 'node:fs'
import crypto from 'node:crypto'
import { gzip, gunzip } from 'node:zlib'
import path from 'node:path'
import { log } from '@common/utils'
import path from 'path'
export const joinPath = (...paths: string[]): string => path.join(...paths)
@@ -15,7 +15,7 @@ export const dirname = (p: string): string => path.dirname(p)
* @param {*} path 路径
*/
export const checkPath = async(path: string): Promise<boolean> => {
return await new Promise(resolve => {
return new Promise(resolve => {
if (!path) {
resolve(false)
return
@@ -31,7 +31,7 @@ export const checkPath = async(path: string): Promise<boolean> => {
}
export const getFileStats = async(path: string): Promise<fs.Stats | null> => {
return await new Promise(resolve => {
return new Promise(resolve => {
if (!path) {
resolve(null)
return
@@ -97,7 +97,7 @@ export const readFile = async(path: string) => fs.promises.readFile(path)
export const toMD5 = (str: string) => crypto.createHash('md5').update(str).digest('hex')
export const gzipData = async(str: string): Promise<Buffer> => {
return await new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
gzip(str, (err, result) => {
if (err) {
reject(err)
@@ -109,7 +109,7 @@ export const gzipData = async(str: string): Promise<Buffer> => {
}
export const gunzipData = async(buf: Buffer): Promise<string> => {
return await new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
gunzip(buf, (err, result) => {
if (err) {
reject(err)

View File

@@ -8,15 +8,31 @@ const easeInOutQuad = (t: number, b: number, c: number, d: number): number => {
type Noop = () => void
const noop: Noop = () => {}
type ScrollElement<T> = {
lx_scrollLockKey?: number
lx_scrollNextParams?: [ScrollElement<HTMLElement>, number, number, Noop]
lx_scrollTimeout?: number
lx_scrollDelayTimeout?: number
} & T
const handleScrollY = (element: HTMLElement, to: number, duration = 300, fn = noop): Noop => {
const handleScrollY = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = noop): Noop => {
if (!element) {
fn()
return noop
}
const clean = () => {
element.lx_scrollLockKey = undefined
element.lx_scrollNextParams = undefined
if (element.lx_scrollTimeout) window.clearTimeout(element.lx_scrollTimeout)
element.lx_scrollTimeout = undefined
}
if (element.lx_scrollLockKey) {
element.lx_scrollNextParams = [element, to, duration, fn]
element.lx_scrollLockKey = -1
return clean
}
// @ts-expect-error
const start = element.scrollTop ?? element.scrollY ?? 0
let cancel = false
if (to > start) {
let maxScrollTop = element.scrollHeight - element.clientHeight
if (to > maxScrollTop) to = maxScrollTop
@@ -34,9 +50,19 @@ const handleScrollY = (element: HTMLElement, to: number, duration = 300, fn = no
}
let currentTime = 0
let val
let val: number
let key = Math.random()
const animateScroll = () => {
element.lx_scrollTimeout = undefined
// if (element.lx_scrollLockKey != key) {
if (element.lx_scrollNextParams && currentTime > duration * 0.75) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
return
}
currentTime += increment
val = Math.trunc(easeInOutQuad(currentTime, start, change, duration))
if (element.scrollTo) {
@@ -45,19 +71,23 @@ const handleScrollY = (element: HTMLElement, to: number, duration = 300, fn = no
element.scrollTop = val
}
if (currentTime < duration) {
if (cancel) {
fn()
return
}
window.setTimeout(animateScroll, increment)
element.lx_scrollTimeout = window.setTimeout(animateScroll, increment)
} else {
fn()
if (element.lx_scrollNextParams) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
} else {
clean()
fn()
}
}
}
element.lx_scrollLockKey = key
animateScroll()
return () => {
cancel = true
}
return clean
}
/**
* 设置滚动条位置
@@ -67,16 +97,24 @@ const handleScrollY = (element: HTMLElement, to: number, duration = 300, fn = no
* @param {*} fn 滚动完成后的回调
* @param {*} delay 延迟执行时间
*/
export const scrollTo = (element: HTMLElement, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
export const scrollTo = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
let cancelFn: () => void
let timeout: number | null
if (element.lx_scrollDelayTimeout != null) {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
if (delay) {
let scrollCancelFn: Noop
cancelFn = () => {
timeout == null ? scrollCancelFn?.() : clearTimeout(timeout)
if (element.lx_scrollDelayTimeout == null) {
scrollCancelFn?.()
} else {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
}
timeout = window.setTimeout(() => {
timeout = null
element.lx_scrollDelayTimeout = window.setTimeout(() => {
element.lx_scrollDelayTimeout = undefined
scrollCancelFn = handleScrollY(element, to, duration, fn)
}, delay)
} else {
@@ -84,14 +122,24 @@ export const scrollTo = (element: HTMLElement, to: number, duration = 300, fn =
}
return cancelFn
}
const handleScrollX = (element: HTMLElement, to: number, duration = 300, fn = () => {}): () => void => {
const handleScrollX = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = () => {}): () => void => {
if (!element) {
fn()
return noop
}
const clean = () => {
element.lx_scrollLockKey = undefined
element.lx_scrollNextParams = undefined
if (element.lx_scrollTimeout) window.clearTimeout(element.lx_scrollTimeout)
element.lx_scrollTimeout = undefined
}
if (element.lx_scrollLockKey) {
element.lx_scrollNextParams = [element, to, duration, fn]
element.lx_scrollLockKey = -1
return clean
}
// @ts-expect-error
const start = element.scrollLeft || element.scrollX || 0
let cancel = false
if (to > start) {
let maxScrollLeft = element.scrollWidth - element.clientWidth
if (to > maxScrollLeft) to = maxScrollLeft
@@ -109,9 +157,18 @@ const handleScrollX = (element: HTMLElement, to: number, duration = 300, fn = ()
}
let currentTime = 0
let val
let val: number
let key = Math.random()
const animateScroll = () => {
element.lx_scrollTimeout = undefined
if (element.lx_scrollNextParams && currentTime > duration * 0.75) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
return
}
currentTime += increment
val = Math.trunc(easeInOutQuad(currentTime, start, change, duration))
if (element.scrollTo) {
@@ -120,19 +177,21 @@ const handleScrollX = (element: HTMLElement, to: number, duration = 300, fn = ()
element.scrollLeft = val
}
if (currentTime < duration) {
if (cancel) {
fn()
return
}
window.setTimeout(animateScroll, increment)
element.lx_scrollTimeout = window.setTimeout(animateScroll, increment)
} else {
fn()
if (element.lx_scrollNextParams) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
} else {
clean()
fn()
}
}
}
element.lx_scrollLockKey = key
animateScroll()
return () => {
cancel = true
}
return clean
}
/**
* 设置滚动条位置
@@ -142,16 +201,24 @@ const handleScrollX = (element: HTMLElement, to: number, duration = 300, fn = ()
* @param {*} fn 滚动完成后的回调
* @param {*} delay 延迟执行时间
*/
export const scrollXTo = (element: HTMLElement, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
export const scrollXTo = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
let cancelFn: Noop
let timeout: number | null
if (element.lx_scrollDelayTimeout != null) {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
if (delay) {
let scrollCancelFn: Noop
cancelFn = () => {
timeout == null ? scrollCancelFn?.() : clearTimeout(timeout)
if (element.lx_scrollDelayTimeout == null) {
scrollCancelFn?.()
} else {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
}
timeout = window.setTimeout(() => {
timeout = null
element.lx_scrollDelayTimeout = window.setTimeout(() => {
element.lx_scrollDelayTimeout = undefined
scrollCancelFn = handleScrollX(element, to, duration, fn)
}, delay)
} else {
@@ -160,14 +227,24 @@ export const scrollXTo = (element: HTMLElement, to: number, duration = 300, fn =
return cancelFn
}
const handleScrollXR = (element: HTMLElement, to: number, duration = 300, fn = () => {}): () => void => {
const handleScrollXR = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = () => {}): () => void => {
if (!element) {
fn()
return noop
}
const clean = () => {
element.lx_scrollLockKey = undefined
element.lx_scrollNextParams = undefined
if (element.lx_scrollTimeout) window.clearTimeout(element.lx_scrollTimeout)
element.lx_scrollTimeout = undefined
}
if (element.lx_scrollLockKey) {
element.lx_scrollNextParams = [element, to, duration, fn]
element.lx_scrollLockKey = -1
return clean
}
// @ts-expect-error
const start = element.scrollLeft || element.scrollX as number || 0
let cancel = false
if (to < start) {
let maxScrollLeft = -element.scrollWidth + element.clientWidth
if (to < maxScrollLeft) to = maxScrollLeft
@@ -186,9 +263,18 @@ const handleScrollXR = (element: HTMLElement, to: number, duration = 300, fn = (
}
let currentTime = 0
let val
let val: number
let key = Math.random()
const animateScroll = () => {
element.lx_scrollTimeout = undefined
if (element.lx_scrollNextParams && currentTime > duration * 0.75) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
return
}
currentTime += increment
val = Math.trunc(easeInOutQuad(currentTime, start, change, duration))
@@ -198,19 +284,23 @@ const handleScrollXR = (element: HTMLElement, to: number, duration = 300, fn = (
element.scrollLeft = val
}
if (currentTime < duration) {
if (cancel) {
fn()
return
}
window.setTimeout(animateScroll, increment)
element.lx_scrollTimeout = window.setTimeout(animateScroll, increment)
} else {
fn()
if (element.lx_scrollNextParams) {
const [_element, to, duration, fn] = element.lx_scrollNextParams
clean()
handleScrollY(_element, to, duration, fn)
} else {
clean()
fn()
}
}
}
element.lx_scrollLockKey = key
animateScroll()
return () => {
cancel = true
}
return clean
}
/**
* 设置滚动条位置 writing-mode: vertical-rl 专用)
@@ -220,16 +310,24 @@ const handleScrollXR = (element: HTMLElement, to: number, duration = 300, fn = (
* @param fn 滚动完成后的回调
* @param delay 延迟执行时间
*/
export const scrollXRTo = (element: HTMLElement, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
export const scrollXRTo = (element: ScrollElement<HTMLElement>, to: number, duration = 300, fn = () => {}, delay = 0): () => void => {
let cancelFn: Noop
let timeout: number | null
if (element.lx_scrollDelayTimeout != null) {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
if (delay) {
let scrollCancelFn: Noop
cancelFn = () => {
timeout == null ? scrollCancelFn?.() : clearTimeout(timeout)
if (element.lx_scrollDelayTimeout == null) {
scrollCancelFn?.()
} else {
window.clearTimeout(element.lx_scrollDelayTimeout)
element.lx_scrollDelayTimeout = undefined
}
}
timeout = window.setTimeout(() => {
timeout = null
element.lx_scrollDelayTimeout = window.setTimeout(() => {
element.lx_scrollDelayTimeout = undefined
scrollCancelFn = handleScrollXR(element, to, duration, fn)
}, delay)
} else {

View File

@@ -17,11 +17,7 @@ import {
type ComputedRef,
type Ref,
type ShallowRef,
defineProps,
defineEmits,
defineComponent,
shallowReactive,
defineExpose,
withDefaults,
} from 'vue'
// import { useStore } from 'vuex'
@@ -75,11 +71,7 @@ export {
unref,
onMounted,
markRaw,
defineProps,
defineEmits,
defineComponent,
shallowReactive,
defineExpose,
withDefaults,
}

15
src/lang/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,15 @@
/* eslint-env node */
const { base, typescript } = require('../../.eslintrc.base.cjs')
module.exports = {
root: true,
...base,
overrides: [
{
...typescript,
parserOptions: {
project: './tsconfig.json',
},
},
],
}

View File

@@ -8,6 +8,7 @@
"btn_confirm": "Confirm",
"btn_save": "Save",
"cancel_button_text": "Cancel",
"cancel_button_text_2": "No, no, no, wrong click",
"close": "Close",
"comment__hot_load_error": "Hot comments failed to load, click to try to reload",
"comment__hot_loading": "Hot comments are loading",
@@ -81,6 +82,7 @@
"list__add_to": "Add to ...",
"list__collect": "Collect",
"list__copy_name": "Copy name",
"list__dislike": "Dislike",
"list__download": "Download",
"list__export_part_desc": "Choose where to save the list file",
"list__file": "Locate the file",
@@ -125,6 +127,7 @@
"list_sort_modal_by_down": "Descending",
"list_sort_modal_by_field": "Sort field",
"list_sort_modal_by_name": "Song name",
"list_sort_modal_by_random": "Random",
"list_sort_modal_by_singer": "Singer name",
"list_sort_modal_by_source": "Song source",
"list_sort_modal_by_time": "Duration",
@@ -136,6 +139,7 @@
"list_update_modal__title": "List update management",
"list_update_modal__update": "Sync",
"lists__add_local_file_desc": "Select song file",
"lists__dislike_music_tip": "Do you really dislike {name}?",
"lists__duplicate": "Duplicate song",
"lists__export": "Export",
"lists__export_part_desc": "Choose where to save the list file",
@@ -147,7 +151,7 @@
"lists__new_list_btn": "Create list",
"lists__new_list_input": "New list...",
"lists__remove": "Remove",
"lists__remove music_tip": "Do you really want to remove the selected {len} songs?",
"lists__remove_music_tip": "Do you really want to remove the selected {len} songs?",
"lists__remove_tip": "Do you really want to remove {name}?",
"lists__remove_tip_button": "Yes, that's right",
"lists__rename": "Rename",
@@ -223,6 +227,7 @@
"player__play_toggle_mode_off": "Disable",
"player__play_toggle_mode_random": "List Random",
"player__play_toggle_mode_single_loop": "Single Loop",
"player__playback_preserves_pitch": "Pitch compensation",
"player__playback_rate": "Current playback rate:",
"player__playback_rate_reset_btn": "Reset",
"player__playing": "Now playing...",
@@ -263,6 +268,10 @@
"player__sound_effect_panner_enabled": "enable",
"player__sound_effect_panner_sound_r": "Sound distance",
"player__sound_effect_panner_sound_speed": "Surround speed",
"player__sound_effect_pitch_shifter": "Pitch adjustment",
"player__sound_effect_pitch_shifter_preset_semitones": "{num} semitones",
"player__sound_effect_pitch_shifter_reset_btn": "Reset",
"player__sound_effect_pitch_shifter_tip": "Since ups and downs need to process audio data in real time, this will cause additional CPU usage\n\nKnown issues:\nIf the CPU resources are not enough, the processing will cause the task to accumulate and the sound will be abnormal. At this time, it is necessary to pause the playback for a period of time and wait for the accumulated tasks to be processed before playing.",
"player__stop": "Paused",
"player__volume": "Volume: ",
"player__volume_mute_label": "Mute",
@@ -376,6 +385,10 @@
"setting__desktop_lyric_shadow_color": "Shadow color",
"setting__desktop_lyric_show_taskbar": "Display lyrics progress on the taskbar (this setting is used as a workaround when the screen recording software cannot capture the lyrics window)",
"setting__desktop_lyric_unplay_color": "Color not playing",
"setting__dislike_list_input_tip": "song name@artist name\nSong name\n@ singer name",
"setting__dislike_list_save_btn": "Save",
"setting__dislike_list_tips": "1. If there is a \"@\" symbol in the song or singer's name, you need to replace it with \"#\"\n2. Specify a song of a singer: Name@Singer\n3. Specify a song: Name\n4. Specify a certain singer: @Singer",
"setting__dislike_list_title": "List of Disliked Song Rules",
"setting__download": "Download",
"setting__download_data_embed": "Whether to embed the following content in the audio file",
"setting__download_embed_lyric": "Embedding lyric",
@@ -415,6 +428,9 @@
"setting__hot_key_desktop_lyric_toggle_visible": "Turn on/off desktop lyrics",
"setting__hot_key_global_title": "Global Shortcut Key",
"setting__hot_key_local_title": "Shortcut Keys in Software",
"setting__hot_key_player_music_dislike": "Dislike the song",
"setting__hot_key_player_music_love": "Favorites Song",
"setting__hot_key_player_music_unlove": "Cancel collection",
"setting__hot_key_player_next": "Next Song",
"setting__hot_key_player_prev": "Previous Song",
"setting__hot_key_player_toggle_play": "Play/Pause Control",
@@ -443,6 +459,9 @@
"setting__odc_clear_search_input": "Clear the search box when you are not searching",
"setting__odc_clear_search_list": "Clear the search list when you are not searching",
"setting__other": "Extras",
"setting__other_dislike_list": "dislike song rule",
"setting__other_dislike_list_label": "Number of rules:",
"setting__other_dislike_list_show_btn": "Edit dislike song rules",
"setting__other_listdata": "List Data Cleanup",
"setting__other_listdata_clear_btn": "Clear my list data",
"setting__other_listdata_clear_tip_confirm": "This will clear all lists you have created and all songs in your favourites, do you really want to continue?",
@@ -468,6 +487,7 @@
"setting__other_tray_theme_native": "White",
"setting__other_tray_theme_origin": "Primary Color",
"setting__play": "Play",
"setting__play_auto_clean_played_list": "Whether to clear the existing playlist when clicking the same list as the playlist to switch songs (all songs in the list in random mode will participate in the random again)",
"setting__play_auto_skip_on_error": "Automatically switch songs on playback error",
"setting__play_detail": "Play details page settings",
"setting__play_detail_align": "Lyric Alignment",
@@ -516,10 +536,16 @@
"setting__sync_server_address": "Synchronization service address: {address}",
"setting__sync_server_auth_code": "Connection code: {code}",
"setting__sync_server_device": "Connected devices: {devices}",
"setting__sync_server_device_list_btn_remove": "Remove",
"setting__sync_server_device_list_noitem": "Nothing here ┗( ▔, ▔ )┛",
"setting__sync_server_device_list_time": "Last connection time: {time}",
"setting__sync_server_device_list_tips": "💡 After the device is removed, you need to re-enter the connection code when reconnecting",
"setting__sync_server_device_list_title": "Certified device",
"setting__sync_server_mode": "Server mode (since the data is transmitted in clear text, please use it under a trusted network)",
"setting__sync_server_port": "Sync port settings",
"setting__sync_server_port_tip": "Please enter the synchronization service port number",
"setting__sync_server_refresh_code": "Refresh the connection code",
"setting__sync_server_show_device_list": "List of certified devices",
"setting__sync_tip": "For how to use it, please see the \"Sync function\" section of the FAQ",
"setting__update": "Update",
"setting__update_checking": "Checking for updates...",
@@ -534,6 +560,7 @@
"setting__update_show_change_log": "Show changelog on first boot after version update",
"setting__update_try_auto_update": "Attempt to download updates automatically when a new version is found",
"setting__update_unknown": "Unknown",
"setting__update_unknown_tip": "❓ Failed to obtain the latest version information, it is recommended to go to the About interface to open the project release address to check whether the current version is the latest",
"setting_sync_status_enabled": "connected",
"song_list": "Playlists",
"songlist__import_input_btn_confirm": "Open",
@@ -564,14 +591,20 @@
"source_xm": "Xiami",
"sync__auth_code_input_tip": "Please enter the connection code",
"sync__auth_code_title": "Need to enter the connection code",
"sync__dislike_merge_tip_desc": "Merge the content of the two lists and remove the duplicates",
"sync__dislike_other_tip_desc": "\"Cancel sync\" will not use the dislike list sync feature",
"sync__dislike_overwrite_tip_desc": "The list of overriddens will be replaced with the list of overriders",
"sync__dislike_title": "Choose how to sync with {name}'s dislike list",
"sync__list_merge_tip_desc": "Merge the two lists together, the same song will be removed (the song of the merged person is removed), and different songs will be added.",
"sync__list_other_tip_desc": "\"Cancel Sync\" will not use list sync.",
"sync__list_overwrite_tip_desc": "The list with the same ID of the covered person and the covered list will be deleted and replaced with the list of the covered person (lists with different list IDs will be merged together). If you check Complete coverage, all lists of the covered person will be moved. \nDivide, and then replace with a list of overriders.",
"sync__list_title": "Choose how to synchronize the list with {name}",
"sync__merge_btn_local_remote": "Local list merge remote list",
"sync__merge_btn_remote_local": "Remote list merge local list",
"sync__merge_label": "Merge",
"sync__merge_tip": "Merge:",
"sync__merge_tip_desc": "Merge the two lists together, the same song will be removed (the song of the merged person is removed), and different songs will be added.",
"sync__other_label": "Other",
"sync__other_tip": "Other: ",
"sync__other_tip_desc": "\"Cancel Sync\" will directly disconnect the two parties.",
"sync__overwrite": "Full coverage",
"sync__overwrite_btn_cancel": "Cancel sync",
"sync__overwrite_btn_local_remote": "Local list Overwrite remote list",
@@ -579,8 +612,6 @@
"sync__overwrite_btn_remote_local": "Remote list Overwrite local list",
"sync__overwrite_label": "Cover",
"sync__overwrite_tip": "Over: ",
"sync__overwrite_tip_desc": "The list with the same ID of the covered person and the covered list will be deleted and replaced with the list of the covered person (lists with different list IDs will be merged together). If you check Complete coverage, all lists of the covered person will be moved. \nDivide, and then replace with a list of overriders.",
"sync__title": "Choose how to synchronize the list with {name}",
"sync_status_disabled": "not connected",
"tag__high_quality": "HQ",
"tag__lossless": "SQ",

View File

@@ -76,7 +76,7 @@ const createI18n = (): I18n => {
return val ? this.fillMessage(targetMessage, val) : targetMessage
},
t(key: keyof Message, val?: TranslateValues): string {
// trackReactivityValues()
trackReactivityValues()
return this.getMessage(key, val)
},
}

View File

@@ -1,14 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext", /* Specify what module code is generated. */
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
// "typeRoots": [
// "./types"
// ],
},
// "include": [
// "**/*.ts",
// "**/*.js",
// "**/*.vue",
// "**/*.json",
// ],
// "exclude": ["dbService"]
}

View File

@@ -8,6 +8,7 @@
"btn_confirm": "确定",
"btn_save": "保存",
"cancel_button_text": "我不",
"cancel_button_text_2": "不不不,点错了",
"close": "关闭",
"comment__hot_load_error": "热门评论加载失败,点击尝试重新加载",
"comment__hot_loading": "热门评论加载中",
@@ -81,6 +82,7 @@
"list__add_to": "添加到...",
"list__collect": "收藏",
"list__copy_name": "复制歌曲名",
"list__dislike": "不喜欢",
"list__download": "下载",
"list__export_part_desc": "选择列表文件保存位置",
"list__file": "定位文件",
@@ -125,6 +127,7 @@
"list_sort_modal_by_down": "降序",
"list_sort_modal_by_field": "排序字段",
"list_sort_modal_by_name": "歌曲名",
"list_sort_modal_by_random": "随机乱序",
"list_sort_modal_by_singer": "歌手名",
"list_sort_modal_by_source": "歌曲源",
"list_sort_modal_by_time": "时长",
@@ -136,6 +139,7 @@
"list_update_modal__title": "列表更新管理",
"list_update_modal__update": "立即更新",
"lists__add_local_file_desc": "选择歌曲文件",
"lists__dislike_music_tip": "你真的不喜欢 {name} 吗?",
"lists__duplicate": "重复歌曲",
"lists__export": "导出",
"lists__export_part_desc": "选择列表文件保存位置",
@@ -147,7 +151,7 @@
"lists__new_list_btn": "新建列表",
"lists__new_list_input": "新列表...",
"lists__remove": "删除",
"lists__remove music_tip": "你真的要移除所选的 {len} 首歌曲吗?",
"lists__remove_music_tip": "你真的要移除所选的 {len} 首歌曲吗?",
"lists__remove_tip": "你真的想要移除 {name} 吗?",
"lists__remove_tip_button": "是的 没错",
"lists__rename": "重命名",
@@ -223,6 +227,7 @@
"player__play_toggle_mode_off": "禁用",
"player__play_toggle_mode_random": "列表随机",
"player__play_toggle_mode_single_loop": "单曲循环",
"player__playback_preserves_pitch": "音调补偿",
"player__playback_rate": "当前播放速率:",
"player__playback_rate_reset_btn": "重置",
"player__playing": "播放中...",
@@ -262,6 +267,10 @@
"player__sound_effect_panner_enabled": "启用",
"player__sound_effect_panner_sound_r": "声音距离",
"player__sound_effect_panner_sound_speed": "环绕速度",
"player__sound_effect_pitch_shifter": "音调升降调节",
"player__sound_effect_pitch_shifter_preset_semitones": "{num} 半音",
"player__sound_effect_pitch_shifter_reset_btn": "重置",
"player__sound_effect_pitch_shifter_tip": "由于升降调需要实时处理音频数据这会导致额外的CPU占用\n\n已知问题\n如果CPU资源不够时将处理导致任务堆积而出现声音异常这时需要暂停播放一段时间等堆积的任务处理完毕再播放",
"player__stop": "暂停播放",
"player__volume": "当前音量:",
"player__volume_mute_label": "静音",
@@ -375,6 +384,10 @@
"setting__desktop_lyric_shadow_color": "阴影颜色",
"setting__desktop_lyric_show_taskbar": "在任务栏显示歌词进程(此设置用于在录屏软件无法捕获歌词窗口时的变通解决方法)",
"setting__desktop_lyric_unplay_color": "未播放颜色",
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
"setting__dislike_list_save_btn": "保存",
"setting__dislike_list_tips": "1. 每条一行,若歌曲或者歌手名字中存在“@”符号,需要将其替换成“#”\n2. 指定某歌手的某首歌:歌曲名@歌手名\n3. 指定某首歌:歌曲名\n4. 指定某歌手:@歌手名",
"setting__dislike_list_title": "不喜欢的歌曲规则列表",
"setting__download": "下载设置",
"setting__download_data_embed": "是否将以下内容嵌入到音频文件中",
"setting__download_embed_lyric": "歌词嵌入",
@@ -414,6 +427,9 @@
"setting__hot_key_desktop_lyric_toggle_visible": "开/关桌面歌词",
"setting__hot_key_global_title": "全局快捷键",
"setting__hot_key_local_title": "软件内快捷键",
"setting__hot_key_player_music_dislike": "不喜欢该歌曲",
"setting__hot_key_player_music_love": "收藏歌曲",
"setting__hot_key_player_music_unlove": "取消收藏",
"setting__hot_key_player_next": "下一首歌曲",
"setting__hot_key_player_prev": "上一首歌曲",
"setting__hot_key_player_toggle_play": "播放/暂停控制",
@@ -442,6 +458,9 @@
"setting__odc_clear_search_input": "离开搜索界面时清空搜索框",
"setting__odc_clear_search_list": "离开搜索界面时清空搜索列表",
"setting__other": "其他",
"setting__other_dislike_list": "不喜欢的歌曲规则",
"setting__other_dislike_list_label": "规则数量:",
"setting__other_dislike_list_show_btn": "编辑不喜欢歌曲规则",
"setting__other_listdata": "列表数据清理",
"setting__other_listdata_clear_btn": "清空我的列表数据",
"setting__other_listdata_clear_tip_confirm": "这将清理你创建的 所有列表 及收藏的 所有歌曲,是否真的要继续?",
@@ -467,6 +486,7 @@
"setting__other_tray_theme_native": "白色",
"setting__other_tray_theme_origin": "原色",
"setting__play": "播放设置",
"setting__play_auto_clean_played_list": "点击与播放列表相同的列表切歌时是否清空已播放列表(随机模式下列表内所有歌曲会重新参与随机)",
"setting__play_auto_skip_on_error": "播放错误时自动切换歌曲",
"setting__play_detail": "播放详情页设置",
"setting__play_detail_align": "歌词对齐方式",
@@ -515,10 +535,16 @@
"setting__sync_server_address": "同步服务地址:{address}",
"setting__sync_server_auth_code": "连接码:{code}",
"setting__sync_server_device": "已连接的设备:{devices}",
"setting__sync_server_device_list_btn_remove": "移除",
"setting__sync_server_device_list_noitem": "这里啥也没有 ┗( ▔, ▔ )┛",
"setting__sync_server_device_list_time": "最后连接时间:{time}",
"setting__sync_server_device_list_tips": "💡 设备被移除后,再连接时需要重新输入连接码",
"setting__sync_server_device_list_title": "已认证设备",
"setting__sync_server_mode": "服务端模式(由于数据是明文传输,请在受信任的网络下使用)",
"setting__sync_server_port": "同步端口设置",
"setting__sync_server_port_tip": "请输入同步服务端口号",
"setting__sync_server_refresh_code": "刷新连接码",
"setting__sync_server_show_device_list": "已认证设备列表",
"setting__sync_tip": "使用方式请看常见问题“同步功能”部分",
"setting__update": "软件更新",
"setting__update_checking": "检查更新中...",
@@ -533,6 +559,7 @@
"setting__update_show_change_log": "更新版本后的首次启动时显示更新日志",
"setting__update_try_auto_update": "发现新版本时尝试自动下载更新",
"setting__update_unknown": "未知",
"setting__update_unknown_tip": "❓ 获取最新版本信息失败,建议去关于界面打开项目发布地址查看当前版本是否最新",
"setting_sync_status_enabled": "已连接",
"song_list": "歌单",
"songlist__import_input_btn_confirm": "打开",
@@ -563,14 +590,20 @@
"source_xm": "虾米音乐",
"sync__auth_code_input_tip": "请输入连接码",
"sync__auth_code_title": "需要输入连接码",
"sync__dislike_merge_tip_desc": "合并两边列表内容并去重",
"sync__dislike_other_tip_desc": "“取消同步”将不使用不喜欢列表同步功能",
"sync__dislike_overwrite_tip_desc": "被覆盖者的列表将被替换成覆盖者的列表",
"sync__dislike_title": "选择与 {name} 的不喜欢列表同步方式",
"sync__list_merge_tip_desc": "将两边的列表合并到一起,相同的歌曲将被去掉(去掉的是被合并者的歌曲),不同的歌曲将被添加。",
"sync__list_other_tip_desc": "“取消同步”将不使用列表同步功能。",
"sync__list_overwrite_tip_desc": "被覆盖者与覆盖者列表ID相同的列表将被删除后替换成覆盖者的列表列表ID不同的列表将被合并到一起若勾选完全覆盖则被覆盖者的所有列表将被移除然后替换成覆盖者的列表。",
"sync__list_title": "选择与 {name} 的列表同步方式",
"sync__merge_btn_local_remote": "本机列表 合并 远程列表",
"sync__merge_btn_remote_local": "远程列表 合并 本机列表",
"sync__merge_label": "合并",
"sync__merge_tip": "合并:",
"sync__merge_tip_desc": "将两边的列表合并到一起,相同的歌曲将被去掉(去掉的是被合并者的歌曲),不同的歌曲将被添加。",
"sync__other_label": "其他",
"sync__other_tip": "其他:",
"sync__other_tip_desc": "“取消同步”将直接断开双方的连接。",
"sync__overwrite": "完全覆盖",
"sync__overwrite_btn_cancel": "取消同步",
"sync__overwrite_btn_local_remote": "本机列表 覆盖 远程列表",
@@ -578,8 +611,6 @@
"sync__overwrite_btn_remote_local": "远程列表 覆盖 本机列表",
"sync__overwrite_label": "覆盖",
"sync__overwrite_tip": "覆盖:",
"sync__overwrite_tip_desc": "被覆盖者与覆盖者列表ID相同的列表将被删除后替换成覆盖者的列表列表ID不同的列表将被合并到一起若勾选完全覆盖则被覆盖者的所有列表将被移除然后替换成覆盖者的列表。",
"sync__title": "选择与 {name} 的列表同步方式",
"sync_status_disabled": "未连接",
"tag__high_quality": "HQ",
"tag__lossless": "SQ",

View File

@@ -8,6 +8,7 @@
"btn_confirm": "確定",
"btn_save": "保存",
"cancel_button_text": "取消",
"cancel_button_text_2": "不不不,點錯了",
"close": "關閉",
"comment__hot_load_error": "熱門評論加載失敗,點擊嘗試重新加載",
"comment__hot_loading": "熱門評論加載中",
@@ -81,6 +82,7 @@
"list__add_to": "添加到...",
"list__collect": "收藏",
"list__copy_name": "複製歌曲名",
"list__dislike": "不喜歡",
"list__download": "下載",
"list__export_part_desc": "選擇列表文件保存位置",
"list__file": "定位文件",
@@ -125,6 +127,7 @@
"list_sort_modal_by_down": "降序",
"list_sort_modal_by_field": "排序字段",
"list_sort_modal_by_name": "歌曲名",
"list_sort_modal_by_random": "隨機亂序",
"list_sort_modal_by_singer": "歌手名",
"list_sort_modal_by_source": "歌曲源",
"list_sort_modal_by_time": "時長",
@@ -136,6 +139,7 @@
"list_update_modal__title": "列表更新管理",
"list_update_modal__update": "立即更新",
"lists__add_local_file_desc": "選擇歌曲文件",
"lists__dislike_music_tip": "你真的不喜歡 {name} 嗎?",
"lists__duplicate": "重複歌曲",
"lists__export": "導出",
"lists__export_part_desc": "選擇列表文件保存位置",
@@ -147,7 +151,7 @@
"lists__new_list_btn": "新建列表",
"lists__new_list_input": "新列表...",
"lists__remove": "刪除",
"lists__remove music_tip": "你真的要移除所選的 {len} 首歌曲嗎?",
"lists__remove_music_tip": "你真的要移除所選的 {len} 首歌曲嗎?",
"lists__remove_tip": "你真的想要移除 {name} 嗎?",
"lists__remove_tip_button": "是的 沒錯",
"lists__rename": "重命名",
@@ -223,6 +227,7 @@
"player__play_toggle_mode_off": "禁用",
"player__play_toggle_mode_random": "列表隨機",
"player__play_toggle_mode_single_loop": "單曲循環",
"player__playback_preserves_pitch": "音調補償",
"player__playback_rate": "當前播放速率:",
"player__playback_rate_reset_btn": "重置",
"player__playing": "播放中...",
@@ -244,7 +249,7 @@
"player__sound_effect_biquad_filter_save_input": "新預設...",
"player__sound_effect_convolution": "環境混響音效",
"player__sound_effect_convolution_file_bright_hall": "大廳",
"player__sound_effect_convolution_file_cardiod_35_10_spread": "搖滾",
"player__sound_effect_convolution_file_cardiod_35_10_spread": "心形擴散",
"player__sound_effect_convolution_file_cinema_diningroom": "電影院",
"player__sound_effect_convolution_file_dining_living_true_stereo": "餐廳",
"player__sound_effect_convolution_file_feedback_spring": "反饋彈簧",
@@ -263,6 +268,10 @@
"player__sound_effect_panner_enabled": "啟用",
"player__sound_effect_panner_sound_r": "聲音距離",
"player__sound_effect_panner_sound_speed": "環繞速度",
"player__sound_effect_pitch_shifter": "音調升降調節",
"player__sound_effect_pitch_shifter_preset_semitones": "{num} 半音",
"player__sound_effect_pitch_shifter_reset_btn": "重置",
"player__sound_effect_pitch_shifter_tip": "由於升降調需要實時處理音頻數據這會導致額外的CPU佔用\n\n已知問題\n如果CPU資源不夠時將處理導致任務堆積而出現聲音異常這時需要暫停播放一段時間等堆積的任務處理完畢再播放",
"player__stop": "暫停播放",
"player__volume": "當前音量:",
"player__volume_mute_label": "靜音",
@@ -376,6 +385,10 @@
"setting__desktop_lyric_shadow_color": "陰影顏色",
"setting__desktop_lyric_show_taskbar": "在任務欄顯示歌詞進程(此設置用於在錄屏軟件無法捕獲歌詞窗口時的變通解決方法)",
"setting__desktop_lyric_unplay_color": "未播放顏色",
"setting__dislike_list_input_tip": "歌曲名@歌手名\n歌曲名\n@歌手名",
"setting__dislike_list_save_btn": "保存",
"setting__dislike_list_tips": "1. 每條一行,若歌曲或者歌手名字中存在“@”符號,需要將其替換成“#”\n2. 指定某歌手的某首歌:歌曲名@歌手名\n3. 指定某首歌:歌曲名\n4. 指定某歌手:@歌手名",
"setting__dislike_list_title": "不喜歡的歌曲規則列表",
"setting__download": "下載設置",
"setting__download_data_embed": "是否將以下內容嵌入到音頻文件中",
"setting__download_embed_lyric": "歌詞嵌入",
@@ -415,6 +428,9 @@
"setting__hot_key_desktop_lyric_toggle_visible": "開/關桌面歌詞",
"setting__hot_key_global_title": "全局快捷鍵",
"setting__hot_key_local_title": "軟件內快捷鍵",
"setting__hot_key_player_music_dislike": "不喜歡該歌曲",
"setting__hot_key_player_music_love": "收藏歌曲",
"setting__hot_key_player_music_unlove": "取消收藏",
"setting__hot_key_player_next": "下一首歌曲",
"setting__hot_key_player_prev": "上一首歌曲",
"setting__hot_key_player_toggle_play": "播放/暫停控制​​",
@@ -443,6 +459,9 @@
"setting__odc_clear_search_input": "離開搜索界面時清空搜索框",
"setting__odc_clear_search_list": "離開搜索界面時清空搜索列表",
"setting__other": "其他",
"setting__other_dislike_list": "不喜歡的歌曲規則",
"setting__other_dislike_list_label": "規則數量:",
"setting__other_dislike_list_show_btn": "編輯不喜歡歌曲規則",
"setting__other_listdata": "列表數據清理",
"setting__other_listdata_clear_btn": "清空我的列表數據",
"setting__other_listdata_clear_tip_confirm": "這將清理你創建的 所有列表 及收藏的 所有歌曲,是否真的要繼續?",
@@ -468,6 +487,7 @@
"setting__other_tray_theme_native": "白色",
"setting__other_tray_theme_origin": "原色",
"setting__play": "播放設置",
"setting__play_auto_clean_played_list": "點擊與播放列表相同的列表切歌時是否清空已播放列表(隨機模式下列表內所有歌曲會重新參與隨機)",
"setting__play_auto_skip_on_error": "播放錯誤時自動切換歌曲",
"setting__play_detail": "播放詳情頁設置",
"setting__play_detail_align": "歌詞對齊方式",
@@ -516,10 +536,16 @@
"setting__sync_server_address": "同步服務地址:{address}",
"setting__sync_server_auth_code": "連接碼:{code}",
"setting__sync_server_device": "已連接的設備:{devices}",
"setting__sync_server_device_list_btn_remove": "移除",
"setting__sync_server_device_list_noitem": "這裡啥也沒有 ┗( ▔, ▔ )┛",
"setting__sync_server_device_list_time": "最後連接時間:{time}",
"setting__sync_server_device_list_tips": "💡 設備被移除後,再連接時需要重新輸入連接碼",
"setting__sync_server_device_list_title": "已認證設備",
"setting__sync_server_mode": "服務端模式(由於數據是明文傳輸,請在受信任的網絡下使用)",
"setting__sync_server_port": "同步端口設置",
"setting__sync_server_port_tip": "請輸入同步服務端口號",
"setting__sync_server_refresh_code": "刷新連接碼",
"setting__sync_server_show_device_list": "已認證設備列表",
"setting__sync_tip": "使用方式請看常見問題“同步功能”部分",
"setting__update": "軟件更新",
"setting__update_checking": "檢查更新中...",
@@ -534,6 +560,7 @@
"setting__update_show_change_log": "更新版本後的首次啟動時顯示更新日誌",
"setting__update_try_auto_update": "發現新版本時嘗試自動下載更新",
"setting__update_unknown": "未知",
"setting__update_unknown_tip": "❓ 獲取最新版本信息失敗,建議去關於界面打開項目發布地址查看當前版本是否最新",
"setting_sync_status_enabled": "已連接",
"song_list": "歌單",
"songlist__import_input_show_btn": "打開歌單",
@@ -563,14 +590,20 @@
"source_xm": "蝦米音樂",
"sync__auth_code_input_tip": "請輸入連接碼",
"sync__auth_code_title": "需要輸入連接碼",
"sync__dislike_merge_tip_desc": "合併兩邊列表內容並去重",
"sync__dislike_other_tip_desc": "“取消同步”將不使用不喜歡列表同步功能",
"sync__dislike_overwrite_tip_desc": "被覆蓋者的列表將被替換成覆蓋者的列表",
"sync__dislike_title": "選擇與 {name} 的不喜歡列表同步方式",
"sync__list_merge_tip_desc": "將兩邊的列表合併到一起,相同的歌曲將被去掉(去掉的是被合併者的歌曲),不同的歌曲將被添加。",
"sync__list_other_tip_desc": "“取消同步”將不使用列表同步功能。",
"sync__list_overwrite_tip_desc": "被覆蓋者與覆蓋者列表ID相同的列表將被刪除後替換成覆蓋者的列表列表ID不同的列表將被合併到一起若勾選完全覆蓋則被覆蓋者的所有列表將被移除然後替換成覆蓋者的列表。",
"sync__list_title": "選擇與 {name} 的列表同步方式",
"sync__merge_btn_local_remote": "本機列表 合併 遠程列表",
"sync__merge_btn_remote_local": "遠程列表 合併 本機列表",
"sync__merge_label": "合併",
"sync__merge_tip": "合併:",
"sync__merge_tip_desc": "將兩邊的列表合併到一起,相同的歌曲將被去掉(去掉的是被合併者的歌曲),不同的歌曲將被添加。",
"sync__other_label": "其他",
"sync__other_tip": "其他:",
"sync__other_tip_desc": "“取消同步”將直接斷開雙方的連接。",
"sync__overwrite": "完全覆蓋",
"sync__overwrite_btn_cancel": "取消同步",
"sync__overwrite_btn_local_remote": "本機列表 覆蓋 遠程列表",
@@ -578,8 +611,6 @@
"sync__overwrite_btn_remote_local": "遠程列表 覆蓋 本機列表",
"sync__overwrite_label": "覆蓋",
"sync__overwrite_tip": "覆蓋:",
"sync__overwrite_tip_desc": "被覆蓋者與覆蓋者列表ID相同的列表將被刪除後替換成覆蓋者的列表列表ID不同的列表將被合併到一起若勾選完全覆蓋則被覆蓋者的所有列表將被移除然後替換成覆蓋者的列表。",
"sync__title": "選擇與 {name} 的列表同步方式",
"sync_status_disabled": "未連接",
"tag__high_quality": "HQ",
"tag__lossless": "SQ",

18
src/main/.eslintrc.cjs Normal file
View File

@@ -0,0 +1,18 @@
/* eslint-env node */
const { base, typescript } = require('../../.eslintrc.base.cjs')
module.exports = {
root: true,
...base,
overrides: [
{
...typescript,
parserOptions: {
project: './tsconfig.json',
},
},
],
ignorePatterns: [
'vendors',
],
}

View File

@@ -1,4 +1,4 @@
import { join, dirname } from 'path'
import path from 'node:path'
import { existsSync, mkdirSync, renameSync } from 'fs'
import { app, shell, screen, nativeTheme, dialog } from 'electron'
import { URL_SCHEME_RXP } from '@common/constants'
@@ -6,26 +6,23 @@ import { getTheme, initHotKey, initSetting, parseEnvParams } from './utils'
import { navigationUrlWhiteList } from '@common/config'
import defaultSetting from '@common/defaultSetting'
import { closeWindow, isExistWindow as isExistMainWindow, showWindow as showMainWindow } from './modules/winMain'
import { createAppEvent, createListEvent } from '@main/event'
import { createAppEvent, createDislikeEvent, createListEvent } from '@main/event'
import { isMac, log } from '@common/utils'
import createWorkers from './worker'
import { migrateDBData } from './utils/migrate'
import { openDirInExplorer } from '@common/utils/electron'
import { encodePath, openDirInExplorer } from '@common/utils/electron'
export const initGlobalData = () => {
global.isDev = process.env.NODE_ENV !== 'production'
const envParams = parseEnvParams()
global.envParams = {
cmdParams: envParams.cmdParams,
deeplink: envParams.deeplink,
}
if (global.isDev) {
// eslint-disable-next-line no-undef
global.staticPath = webpackStaticPath
} else {
global.staticPath = join(__dirname, '/static')
}
global.staticPath =
process.env.NODE_ENV !== 'production'
? webpackStaticPath
: path.join(encodePath(__dirname), 'static')
}
export const initSingleInstanceHandle = () => {
@@ -75,10 +72,10 @@ export const applyElectronEnvParams = () => {
export const setUserDataPath = () => {
// windows平台下如果应用目录下存在 portable 文件夹则将数据存在此文件下
if (process.platform == 'win32') {
const portablePath = join(dirname(app.getPath('exe')), '/portable')
const portablePath = path.join(path.dirname(app.getPath('exe')), '/portable')
if (existsSync(portablePath)) {
app.setPath('appData', portablePath)
const appDataPath = join(portablePath, '/userData')
const appDataPath = path.join(portablePath, '/userData')
if (!existsSync(appDataPath)) mkdirSync(appDataPath)
app.setPath('userData', appDataPath)
}
@@ -86,12 +83,12 @@ export const setUserDataPath = () => {
const userDataPath = app.getPath('userData')
global.lxOldDataPath = userDataPath
global.lxDataPath = join(userDataPath, 'LxDatas')
global.lxDataPath = path.join(userDataPath, 'LxDatas')
if (!existsSync(global.lxDataPath)) mkdirSync(global.lxDataPath)
}
export const registerDeeplink = (startApp: () => void) => {
if (global.isDev && process.platform === 'win32') {
if (process.env.NODE_ENV !== 'production' && process.platform === 'win32') {
// Set the path of electron.exe and your app.
// These two additional parameters are only available on windows.
// console.log(process.execPath, process.argv)
@@ -117,8 +114,8 @@ export const registerDeeplink = (startApp: () => void) => {
export const listenerAppEvent = (startApp: () => void) => {
app.on('web-contents-created', (event, contents) => {
contents.on('will-navigate', (event, navigationUrl) => {
if (global.isDev) {
console.log('navigation to url:', navigationUrl)
if (process.env.NODE_ENV !== 'production') {
console.log('navigation to url:', navigationUrl.length > 130 ? navigationUrl.substring(0, 130) + '...' : navigationUrl)
return
}
if (!navigationUrlWhiteList.some(url => url.test(navigationUrl))) {
@@ -215,6 +212,7 @@ export const initAppSetting = async() => {
// mainWindowClosed: true,
event_app: createAppEvent(),
event_list: createListEvent(),
event_dislike: createDislikeEvent(),
appSetting: defaultSetting,
worker: createWorkers(),
hotKey: {
@@ -240,13 +238,13 @@ export const initAppSetting = async() => {
if (!isInitialized) {
let dbFileExists = await global.lx.worker.dbService.init(global.lxDataPath)
if (dbFileExists === null) {
const backPath = join(global.lxDataPath, `lx.data.db.${Date.now()}.bak`)
const backPath = path.join(global.lxDataPath, `lx.data.db.${Date.now()}.bak`)
dialog.showMessageBoxSync({
type: 'warning',
message: 'Database verify failed',
detail: `数据库表结构校验失败,我们将把有问题的数据库备份到:${backPath}\n若此问题导致你的数据丢失你可以尝试从备份文件找回它们。\n\nThe database table structure verification failed, we will back up the problematic database to: ${backPath}\nIf this problem causes your data to be lost, you can try to retrieve them from the backup file.`,
})
renameSync(join(global.lxDataPath, 'lx.data.db'), backPath)
renameSync(path.join(global.lxDataPath, 'lx.data.db'), backPath)
openDirInExplorer(backPath)
dbFileExists = await global.lx.worker.dbService.init(global.lxDataPath)
}
@@ -256,7 +254,7 @@ export const initAppSetting = async() => {
}
// global.lx.theme = getTheme()
isInitialized = true
isInitialized ||= true
}
export const quitApp = () => {

View File

@@ -102,4 +102,4 @@ declare class EventType extends Event {
off<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
}
export declare type Type = Omit<EventType, keyof Omit<EventEmitter, 'on' | 'off' | 'once'>>
export type Type = Omit<EventType, keyof Omit<EventEmitter, 'on' | 'off' | 'once'>>

View File

@@ -0,0 +1,56 @@
import { EventEmitter } from 'events'
export class Event extends EventEmitter {
dislike_changed() {
this.emit('dislike_changed')
}
/**
* 覆盖整个列表数据
* @param dislikeData 列表数据
* @param isRemote 是否属于远程操作
*/
async dislike_data_overwrite(dislikeData: LX.Dislike.DislikeRules, isRemote: boolean = false) {
await global.lx.worker.dbService.dislikeInfoOverwrite(dislikeData)
this.emit('dislike_data_overwrite', dislikeData, isRemote)
this.dislike_changed()
}
/**
* 批量添加歌曲到列表
* @param dislikeId 列表id
* @param musicInfos 添加的歌曲信息
* @param addMusicLocationType 添加在到列表的位置
* @param isRemote 是否属于远程操作
*/
async dislike_music_add(musicInfo: LX.Dislike.DislikeMusicInfo[], isRemote: boolean = false) {
// const changedIds =
await global.lx.worker.dbService.dislikeInfoAdd(musicInfo)
// await checkUpdateDislike(changedIds)
this.emit('dislike_music_add', musicInfo, isRemote)
this.dislike_changed()
}
/**
* 清空列表内的歌曲
* @param ids 列表Id
* @param isRemote 是否属于远程操作
*/
async dislike_music_clear(isRemote: boolean = false) {
// const changedIds =
await global.lx.worker.dbService.dislikeInfoOverwrite('')
// await checkUpdateDislike(changedIds)
this.emit('dislike_music_clear', isRemote)
this.dislike_changed()
}
}
type EventMethods = Omit<EventType, keyof EventEmitter>
declare class EventType extends Event {
on<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
once<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
off<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
}
export type Type = Omit<EventType, keyof Omit<EventEmitter, 'on' | 'off' | 'once'>>

View File

@@ -14,6 +14,18 @@ import { EventEmitter } from 'events'
// musicOverwrite,
// } from '@main/workers/dbService/modules/list'
// 兼容v2.3.0之前版本插入数字类型的ID导致其意外在末尾追加 .0 的问题确保所有ID都是字符串类型
const fixListIdType = (lists: LX.List.UserListInfo[] | LX.List.UserListInfoFull[]) => {
for (const list of lists) {
if (typeof list.sourceListId == 'number') {
list.sourceListId = String(list.sourceListId)
if (typeof list.id == 'number') {
list.id = String(list.id)
}
}
}
}
export class Event extends EventEmitter {
list_changed() {
this.emit('list_changed')
@@ -25,6 +37,7 @@ export class Event extends EventEmitter {
* @param isRemote 是否属于远程操作
*/
async list_data_overwrite(listData: MakeOptional<LX.List.ListDataFull, 'tempList'>, isRemote: boolean = false) {
fixListIdType(listData.userList)
await global.lx.worker.dbService.listDataOverwrite(listData)
this.emit('list_data_overwrite', listData, isRemote)
this.list_changed()
@@ -37,6 +50,7 @@ export class Event extends EventEmitter {
* @param isRemote 是否属于远程操作
*/
async list_create(position: number, lists: LX.List.UserListInfo[], isRemote: boolean = false) {
fixListIdType(lists)
await global.lx.worker.dbService.createUserLists(position, lists)
this.emit('list_create', position, lists, isRemote)
this.list_changed()
@@ -171,4 +185,4 @@ declare class EventType extends Event {
once<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
off<K extends keyof EventMethods>(event: K, listener: EventMethods[K]): this
}
export declare type Type = Omit<EventType, keyof Omit<EventEmitter, 'on' | 'off' | 'once'>>
export type Type = Omit<EventType, keyof Omit<EventEmitter, 'on' | 'off' | 'once'>>

View File

@@ -1,9 +1,11 @@
import { Event as App, type Type as AppType } from './AppEvent'
import { Event as List, type Type as ListType } from './ListEvent'
import { Event as Dislike, type Type as DislikeType } from './DislikeEvent'
export type {
AppType,
ListType,
DislikeType,
}
export const createAppEvent = (): AppType => {
@@ -14,3 +16,7 @@ export const createListEvent = (): ListType => {
return new List()
}
export const createDislikeEvent = (): DislikeType => {
return new Dislike()
}

View File

@@ -6,7 +6,7 @@
*/
import { app } from 'electron'
import * as electronDebug from 'electron-debug'
import electronDebug from 'electron-debug'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
// Install `electron-debug` with `devtron`
electronDebug({

View File

@@ -1,4 +1,5 @@
import { app } from 'electron'
import './utils/logInit'
import '@common/error'
import {
initGlobalData,

View File

@@ -20,7 +20,7 @@ export default () => {
})
mainHandle<string[]>(CMMON_EVENT_NAME.get_system_fonts, async() => {
return await getFonts()
return getFonts()
})
}

View File

@@ -0,0 +1,3 @@
export { registerRendererEvents } from './winRendererEvent'
export { default } from './rendererEvent'

View File

@@ -0,0 +1,18 @@
import { mainHandle } from '@common/mainIpc'
import { DISLIKE_EVENT_NAME } from '@common/ipcNames'
// 列表操作事件(公共,只注册一次)
export default () => {
mainHandle<LX.Dislike.DislikeInfo>(DISLIKE_EVENT_NAME.get_dislike_music_infos, async() => {
return global.lx.worker.dbService.getDislikeListInfo()
})
mainHandle<LX.Dislike.DislikeMusicInfo[]>(DISLIKE_EVENT_NAME.add_dislike_music_infos, async({ params: listData }) => {
await global.lx.event_dislike.dislike_music_add(listData, false)
})
mainHandle<LX.Dislike.DislikeRules>(DISLIKE_EVENT_NAME.overwrite_dislike_music_infos, async({ params: rules }) => {
await global.lx.event_dislike.dislike_data_overwrite(rules, false)
})
mainHandle(DISLIKE_EVENT_NAME.clear_dislike_music_infos, async() => {
await global.lx.event_dislike.dislike_music_clear(false)
})
}

View File

@@ -0,0 +1,24 @@
import { DISLIKE_EVENT_NAME } from '@common/ipcNames'
// 发送列表操作事件到渲染进程的注册方法
// 哪个渲染进程需要接收则引入此方法注册
export const registerRendererEvents = (sendEvent: <T = any>(name: string, params?: T | undefined) => void) => {
const dislike_music_add = async(listData: LX.Dislike.DislikeMusicInfo[]) => {
sendEvent<LX.Dislike.DislikeMusicInfo[]>(DISLIKE_EVENT_NAME.add_dislike_music_infos, listData)
}
const dislike_data_overwrite = async(rules: LX.Dislike.DislikeRules) => {
sendEvent<LX.Dislike.DislikeRules>(DISLIKE_EVENT_NAME.overwrite_dislike_music_infos, rules)
}
const dislike_music_clear = async() => {
sendEvent(DISLIKE_EVENT_NAME.clear_dislike_music_infos)
}
global.lx.event_dislike.on('dislike_music_add', dislike_music_add)
global.lx.event_dislike.on('dislike_data_overwrite', dislike_data_overwrite)
global.lx.event_dislike.on('dislike_music_clear', dislike_music_clear)
return () => {
global.lx.event_dislike.off('dislike_music_add', dislike_music_add)
global.lx.event_dislike.off('dislike_data_overwrite', dislike_data_overwrite)
global.lx.event_dislike.off('dislike_music_clear', dislike_music_clear)
}
}

View File

@@ -1,7 +1,9 @@
import common from './common'
import list from './list'
import dislike from './dislike'
export default () => {
common()
list()
dislike()
}

View File

@@ -4,7 +4,7 @@ import { PLAYER_EVENT_NAME } from '@common/ipcNames'
// 列表操作事件(公共,只注册一次)
export default () => {
mainHandle<LX.List.UserListInfo[]>(PLAYER_EVENT_NAME.list_get, async() => {
return await global.lx.worker.dbService.getAllUserList()
return global.lx.worker.dbService.getAllUserList()
})
mainHandle<LX.List.ListActionDataOverwrite>(PLAYER_EVENT_NAME.list_data_overwire, async({ params: listData }) => {
await global.lx.event_list.list_data_overwrite(listData, false)
@@ -22,7 +22,7 @@ export default () => {
await global.lx.event_list.list_update_position(position, ids, false)
})
mainHandle<string, LX.Music.MusicInfo[]>(PLAYER_EVENT_NAME.list_music_get, async({ params: listId }) => {
return await global.lx.worker.dbService.getListMusics(listId)
return global.lx.worker.dbService.getListMusics(listId)
})
mainHandle<LX.List.ListActionMusicAdd>(PLAYER_EVENT_NAME.list_music_add, async({ params: { id, musicInfos, addMusicLocationType } }) => {
await global.lx.event_list.list_music_add(id, musicInfos, addMusicLocationType, false)
@@ -46,9 +46,9 @@ export default () => {
await global.lx.event_list.list_music_clear(listId, false)
})
mainHandle<LX.List.ListActionCheckMusicExistList, boolean>(PLAYER_EVENT_NAME.list_music_check_exist, async({ params: { listId, musicInfoId } }) => {
return await global.lx.worker.dbService.checkListExistMusic(listId, musicInfoId)
return global.lx.worker.dbService.checkListExistMusic(listId, musicInfoId)
})
mainHandle<string, string[]>(PLAYER_EVENT_NAME.list_music_get_list_ids, async({ params: musicInfoId }) => {
return await global.lx.worker.dbService.getMusicExistListIds(musicInfoId)
return global.lx.worker.dbService.getMusicExistListIds(musicInfoId)
})
}

View File

@@ -1,8 +1,9 @@
import { request, generateRsaKey } from './utils'
import { getSyncAuthKey, setSyncAuthKey } from '../data'
import { SYNC_CODE } from '@common/constants'
import { getSyncAuthKey, setSyncAuthKey } from './data'
import log from '../log'
import { aesDecrypt, aesEncrypt, getComputerName, rsaDecrypt } from '../utils'
import { toMD5 } from '@common/utils/nodejs'
import { SYNC_CODE } from '@common/constants_sync'
const hello = async(urlInfo: LX.Sync.Client.UrlInfo) => request(`${urlInfo.httpProtocol}//${urlInfo.hostPath}/hello`)
@@ -25,7 +26,7 @@ const getServerId = async(urlInfo: LX.Sync.Client.UrlInfo) => request(`${urlInfo
})
const codeAuth = async(urlInfo: LX.Sync.Client.UrlInfo, serverId: string, authCode: string) => {
let key = ''.padStart(16, Buffer.from(authCode).toString('hex'))
let key = toMD5(authCode).substring(0, 16)
// const iv = Buffer.from(key.split('').reverse().join('')).toString('base64')
key = Buffer.from(key).toString('base64')
let { publicKey, privateKey } = await generateRsaKey()

Some files were not shown because too many files have changed in this diff Show More