-
Notifications
You must be signed in to change notification settings - Fork 221
Pr/cleanfix: 落实 PR #365 CodeRabbit 评审(不喜欢鉴权/专辑契约/音质源配置等) #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cecc5d0
Merge pull request #349 from XCQ0607/dev
XCQ0607 cc96cfa
feat(subsonic): dislike 增强、音质/源优选、setRating 评分与每日推荐,修复音频流截断
pyss56 f870a5e
Merge remote-tracking branch 'upstream/dev' into pr/clean
pyss56 c5f6a7e
fix: 落实 PR #365 CodeRabbit 评审(不喜欢鉴权/专辑契约/音质源配置等)
pyss56 fef85c9
chore: 更新前端构建版本号 buildHash
pyss56 4621183
chore: 从 PR 移除服务端属性测试(subsonic-encode),仅保留功能代码
pyss56 a7900f5
docs: 补充本 PR 涉及函数的 JSDoc 以满足 docstring coverage
pyss56 117901f
feat(dislike): 新增前端 dislike 规则管理与持久化存储支持
XCQ0607 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # Subsonic 协议支持状态对照 | ||
|
|
||
| > 范围:`src/server/subsonic.ts` 对 Subsonic REST API 的**自定义实现**对照表。 | ||
| > 图例:✅ 已实现可用 🟡 占位(返回空 / no-op,兼容客户端握手) ❌ 未实现(返回 `Method not found`) | ||
| > 更新:2026-09-10(新增「每日推荐歌曲」接口,见文末) | ||
|
|
||
| --- | ||
|
|
||
| ## 一、已实现 / 可用接口 | ||
|
|
||
| | 方法 (method) | 类别 | 状态 | 说明 | | ||
| |---|---|---|---| | ||
| | `ping` | 系统 | ✅ | 握手 / 存活检测 | | ||
| | `getLicense` | 系统 | ✅ | 许可信息 | | ||
| | `getScanStatus` | 系统 | 🟡 | 固定返回 `scanning:false` | | ||
| | `getMusicFolders` | 浏览 | ✅ | 单一音乐库 | | ||
| | `getMusicDirectory` | 浏览 | ✅ | 专辑 / 歌单 / 歌手目录 | | ||
| | `getGenres` | 浏览 | ✅ | 流派(来自 QQ 音乐 discovery) | | ||
| | `getArtists` | 浏览 | ✅ | 按字母索引的歌手 | | ||
| | `getArtist` | 浏览 | ✅ | 歌手详情 | | ||
| | `getArtistInfo` / `getArtistInfo2` | 浏览 | ✅ | 歌手信息 | | ||
| | `getAlbum` | 浏览 | ✅ | 专辑详情(含歌曲列表) | | ||
| | `getAlbumList` / `getAlbumList2` | 浏览 | ✅ | 含 `recommend`/`random`/`newest`/`recent` 推荐专辑逻辑 | | ||
| | `getStarred` / `getStarred2` | 浏览 | ✅ | 收藏 | | ||
| | `getSong` | 媒体 | ✅ | 单曲信息 | | ||
| | `stream` / `download` | 媒体 | ✅ | 在线音频流(按 `source_songmid` 解析) | | ||
| | `getCoverArt` | 媒体 | ✅ | 封面代理 | | ||
| | `getUser` | 用户 | ✅ | 当前用户 | | ||
| | `search` / `search2` / `search3` | 搜索 | ✅ | 本地 + 在线全网搜索 | | ||
| | `getPlaylists` / `getPlaylist` | 歌单 | ✅ | | | ||
| | `createPlaylist` / `updatePlaylist` / `deletePlaylist` | 歌单 | ✅ | | | ||
| | `star` / `unstar` | 收藏 | ✅ | | | ||
| | `setRating` | 评分 | ✅ | 评分按用户持久化(0-5,0=清除);每日推荐会排除评分落入「不喜欢」阈值(`subsonic.dislikeRating`,默认 1)的歌曲 | | ||
| | `scrobble` | 播放 | 🟡 | no-op(返回成功) | | ||
| | `getNowPlaying` | 播放 | 🟡 | 返回空列表 | | ||
| | `getLyrics` / `getLyricsBySongId` | 歌词 | ✅ | | | ||
| | `getOpenSubsonicExtensions` | 扩展 | ✅ | | | ||
| | `getRandomSongs` | 发现 | ✅ | 本地库随机 / 流派随机 | | ||
| | `getSongsByGenre` / `getSongsByGenre2` | 发现 | ✅ | 按流派拉取云端歌曲 | | ||
| | `getSimilarSongs` / `getSimilarSongs2` | 发现 | ✅ | 同歌手相似 | | ||
| | `getTopSongs` | 发现 | ✅ | 歌手热门 | | ||
| | `getInternetRadioStations` | 电台 | ✅ | QQ 音乐电台 | | ||
| | **`getRecommendedSongs`** | **发现(新增)** | ✅ | **每日推荐歌曲(见第二节)** | | ||
| | **`getDailySongs`** | **发现(新增)** | ✅ | **`getRecommendedSongs` 的别名** | | ||
| | **`getSongsByTag`** | **发现(新增)** | ✅ | **别名,同样映射为每日推荐**(lx-server 未实现独立按标签检索) | | ||
|
|
||
| --- | ||
|
|
||
| ## 二、新增:每日推荐歌曲(2026-09-10 实现) | ||
|
|
||
| ### 背景 | ||
| 此前代码里**完全没有**歌曲级「每日推荐」接口(`getRecommendedSongs` / `getDailySongs` / `getSongsByTag` / `DailySongs` 在 `subsonic.ts` 中均为空,走 default 分支返回 `Method not found`)。仅 `getAlbumList2` 带有「推荐专辑」逻辑(`cachedRecommend → fetchRecommendedAlbums`,专辑级)。 | ||
|
|
||
| ### 实现 | ||
| - 新增数据源 `src/server/utils/recommendSongs.ts`:`fetchRecommendedSongs(size)` | ||
| - 复用已验证的 `fetchRecommendedAlbums('random')` 拿推荐专辑; | ||
| - 逐张调用 `musicSdk.tx.extendDetail.getAlbumSongs(mid)` 取出专辑内歌曲; | ||
| - 按 `tx_<songmid>` 去重,按「自然日」做种子洗牌(当天稳定、跨天换批),返回可直接播放的在线歌曲。 | ||
| - 全程公开接口、无需登录;QQ 抓取失败时回退到上次成功结果,避免每日推荐空白。 | ||
| - **评分过滤**:返回前按请求用户过滤——评分落入「不喜欢」区间(`0 < rating <= subsonic.dislikeRating`,默认阈值为 1,可配置)的歌曲不会进入每日推荐(`setRating` 设置)。 | ||
| - `subsonic.ts` 分发开关新增 `case 'getRecommendedSongs' / 'getDailySongs' / 'getSongsByTag'`,handler `handleGetRecommendedSongs` 复用 `renderRandomSongs` 输出(与 `getRandomSongs`/`getSongsByGenre` 同一条渲染链路,封面 / 播放均正常)。 | ||
|
|
||
| ### 调用示例 | ||
| ``` | ||
| GET /rest/getRecommendedSongs?u=<user>&p=<pass>&f=json&size=20 | ||
| GET /rest/getDailySongs?u=<user>&p=<pass>&f=json | ||
| ``` | ||
| 返回结构:`{ recommendedSongs: { song: [ ... ] } }`(XML 下为 `recommendedSongs > children > song`)。 | ||
|
|
||
| --- | ||
|
|
||
| ## 三、未实现(官方标准方法,当前返回 `Method not found`) | ||
|
|
||
| | 方法 | 类别 | | ||
| |---|---| | ||
| | `getIndexes` | 浏览 | | ||
| | `getVideos` | 媒体 | | ||
| | `getBookmarks` / `createBookmark` / `deleteBookmark` | 书签 | | ||
| | `getPlayQueue` / `savePlayQueue` | 播放队列 | | ||
| | `createUser` / `updateUser` / `deleteUser` / `changePassword` / `getAvatar` | 用户管理 | | ||
| | `getPodcasts` / `getNewestPodcasts` / `refreshPodcasts` 等播客系列 | 播客 | | ||
| | `getChatMessages` / `createChatMessage` | 聊天 | | ||
| | `createShare` / `getShares` / `deleteShare` | 分享 | | ||
| | `createInternetRadioStation` / `updateInternetRadioStation` / `deleteInternetRadioStation` | 电台管理 | | ||
|
|
||
| > 注:lx-server 定位是「个人音乐库桥接」,未实现多用户管理 / 播客 / 分享 / 聊天等协作类接口属预期范围。 |
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: XCQ0607/lxserver
Length of output: 202
🏁 Script executed:
Repository: XCQ0607/lxserver
Length of output: 1827
修正
test:unit的测试路径。test目录不存在,因此test/*.test.ts不会匹配文件,脚本会将该字面路径传给tsx,无法运行单元测试。tsx已声明为^4.23.1,无需重复添加依赖。请新增匹配的 TypeScript 测试文件,或将路径改为实际测试目录。🤖 Prompt for AI Agents