A cookie file on a live deployment held this:
MUSIC_A_T=1456043741268; Max-Age=2147483647; Expires=Thu, 25 Nov 2094 ...;
Path=/api/clientlog;;MUSIC_R_T=...; Max-Age=...; Path=/eapi/feedback; ...
That is a `Set-Cookie` header pasted whole. The cookie is then handed to the
sidecar as `?cookie=<the whole thing>`, so `Max-Age`, `Expires` and `Path` are
read as cookie NAMES and the string grows to several KB before URL-encoding.
Measured on that box (data/logs/bot.log):
- 34 of 34 `/song/url/v1` calls failed with `ERR_BAD_REQUEST` (HTTP 400);
- the same failure is still happening today, e.g. 17:14 and 17:20 local;
- every one surfaced to the user as 「无法播放(区域/版权限制)」.
So the message people were chasing for weeks is not a copyright signal at all
— it is the sidecar rejecting a malformed request.
`normalizeCookie()` drops attribute pairs, the `Set-Cookie:` prefix, CR/LF and
duplicate names, and keeps only real `name=value` pairs. It is applied:
- on `save()`, so nothing malformed reaches the file again;
- on `load()`, and **written back when it differs** — an existing deployment is
repaired in place without asking anyone to scan a QR code again;
- in `setCookie()` of all four providers, including Kugou, which parses into a
map and would otherwise store `max-age` as a device field.
jellyfin is excluded: its blob is JSON (accessToken/userId/deviceId), not a
cookie header, and normalising it would shred the payload. A test pins that.
Valid cookies are untouched — `normalizeCookie` is idempotent and byte-exact on
a clean string, and a clean file is not rewritten.
This does not overlap with the play-URL retry PR: that one retries a genuine
`url: null`, this one stops the request from being rejected before it is sent.
Both are needed — retrying a 400 just gets four more 400s.
Upstream a0f0b49..6f165b5 added the pause/resume fade tail but shipped no
test updates, leaving 5 assertions red (also reproducible on pristine
upstream/main, so not merge-induced).
- instance-recovery/instance harnesses: stub players borrow
AudioPlayer.prototype.pause/resume, which now call this.setTransportRamp().
Give the stubs that method or they throw TypeError on pause/resume.
- voice-failure: pausing deliberately emits a fade tail, so the frame count
no longer freezes at exactly 50. Assert the de-click fade completes, then
that the scheduler and elapsed clock are genuinely frozen — the actual
behavior under test.
No production code changed.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Adds artist support for the NetEase and QQ providers plus the matching UI.
Backend:
- SearchResult gains `artists`; new optional MusicProvider methods
getArtistDetail / getArtistSongs / getArtistAlbums / getArtistAllSongs.
- NetEase: /cloudsearch type=100 for artist search, /artists, /artist/songs,
/artist/album and /artist/desc for the artist page.
- QQ: singer search rides along in the existing musicu.fcg batch
(search_type=1); singer detail via music.web_singer_info_svr. QQ exposes no
working singer-song paging endpoint, so the full catalogue is built from the
hot 50 plus every album of the singer (album search filtered by singerMID,
songs fetched per album, de-duplicated, cached for 10 minutes). A failed
album sweep is never cached and degrades to the hot list.
- API: GET /api/music/artist/:id and POST /api/player/:botId/play-artist
(player.control capability, guest flag playCollection); /search/all now
aggregates artists too.
Frontend:
- Search history in localStorage (max 10, per platform, never shared between
users), shown as a dropdown under the search box and as 最近搜索 chips.
- Artist row in the search results; new /artist/:id page (portrait, aliases,
stats, description, top songs, album shelf) with 播放 / 随机播放, which queue
the singer's whole catalogue.
- playArtist store action.
Tests cover the provider mappers, the new routes, the play-artist collector
(paging, de-duplication, 500-track cap), permission gating and the new views.
With several people sharing one bot, personal FM always followed the one
account the bot was logged in with. Each signed-in (non-guest) web user
can now scan a QR code under Settings → 账户 to link their own NetEase
account; FM they start from the WebUI then comes from their account.
- user_music_cookies table (per user + platform, dropped with the user).
- NeteaseProvider.pollQrLogin returns the cookie without storing it, so
a personal login can never replace the bot's shared account;
checkQrCodeStatus is now built on it. withCookie gives a view bound to
another account.
- /api/me/music/netease: status / qrcode / qrcode/status / unlink, acting
only on req.user. The cookie never leaves the server.
- POST /api/player/:botId/fm uses the caller's linked account for
NetEase. Songs still resolve through the shared provider when played.
TeamSpeak chat !fm keeps using the shared account: chat users are not
tied to web accounts.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Long B站 videos (2-3 h) still stopped ~15-20 min in, the same symptom as
#89. Reconnecting to the same URL is not enough once the CDN session is
gone, so:
- Prefer an upos/cos mirror from baseUrl + backupUrl over PCDN hosts
(*.mcdn.bilivideo.cn, *.szbdyd.com), which are the ones that cut off.
- When a B站 track ends more than 30 s before its known duration, fetch
a fresh URL and resume at the current position instead of advancing.
Up to 3 attempts without real progress, then advance as before; a
track the user started meanwhile is never clobbered.
- Seek B站 URLs input-side (-ss before -i). Their CDN serves Range, so a
resume jumps to the byte offset instead of re-downloading everything
before it (measured locally: 0.2 s vs a full-file download at 1.5 h
into a 2 h fMP4), which would otherwise trip the 60 s stall watchdog.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
install.sh still installed Node 20 (dropped in #152), ran the Debian-only
NodeSource script on yum systems, and hard-coded /usr/bin/node. The
README only mentioned install.sh, not setup.sh.
install.sh now:
- installs Node 22 LTS from the right NodeSource repo per distro and
checks the same 22.12+/24+ floor as setup.sh
- delegates npm install, mirror detection, native-binary checks and the
build to setup.sh, so the two scripts share one install path
- stops the service and replaces dist/node_modules on re-install (data/
is kept), copies bin/ (yt-dlp), and uses the real node path in the unit
README explains the difference between the two scripts and when to use
which. setup.sh's "Node.js not found" message no longer says 20+.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`!playlist` already pulled a numeric id out of a URL, but the platform
still came from flags, so a QQ link without -q was looked up on NetEase,
and a YouTube ?list= link fell through to a name search on the URL.
- Detect NetEase / QQ Music / YouTube playlist links (also inside an
app's share text and the [URL] BBCode TeamSpeak adds) and take the
platform from the link.
- Follow NetEase (163cn.tv) and QQ (c6.y.qq.com/base/fcgi-bin/u) share
short links one hop. Only those hosts are fetched.
- Document it in the README command table.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
When the bot was moved to another channel, the channel it left kept the
now-playing description forever: updateChannelDescription always targeted
getChannelId(), which by then already reported the new channel.
Remember which channel we last wrote to. On a self clientMoved event,
clear that channel and, if a song is playing, write the description to
the new one. Stop now clears the channel we actually wrote to, so a
missed move event can't leave a stale description behind either.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>