fix(api): align native client UA with the WebView to collapse the duplicate Navidrome session (#1322)

* fix(api): align native client UA with the WebView to collapse the duplicate Navidrome session

* docs(changelog): duplicate Navidrome session fix (#1322)
This commit is contained in:
Psychotoxical
2026-07-17 13:56:18 +02:00
committed by GitHub
parent 7dfe58dba6
commit c74e8f1921
3 changed files with 14 additions and 2 deletions
+6
View File
@@ -357,6 +357,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* The Square Corners toggle left the player bar cover and the small cover thumbnails in list rows rounded (queue, playlists, favorites, search, Random Mix). They now go square with everything else; the floating player bar's circular cover stays round by design. * The Square Corners toggle left the player bar cover and the small cover thumbnails in list rows rounded (queue, playlists, favorites, search, Random Mix). They now go square with everything else; the floating player bar's circular cover stays round by design.
### Duplicate server session on Navidrome
**By [@Psychotoxical](https://github.com/Psychotoxical), reported by TheHomeGuy on the Psysonic Discord, PR [#1322](https://github.com/Psychotoxical/psysonic/pull/1322)**
* Native requests carried a separate User-Agent from the in-app view, so the server listed the app as two logged-in players at once. They now share one identity and show as a single session.
## [1.49.0] - 2026-06-29 ## [1.49.0] - 2026-06-29
@@ -123,7 +123,10 @@ pub fn nd_http_client() -> reqwest::Client {
// the WebKit-side Subsonic calls end up negotiating most of the time // the WebKit-side Subsonic calls end up negotiating most of the time
// on these setups. // on these setups.
reqwest::Client::builder() reqwest::Client::builder()
.user_agent(format!("Psysonic/{} (Tauri)", env!("CARGO_PKG_VERSION"))) // Shared wire UA (the main WebView's User-Agent once the frontend reports
// it at startup) so Navidrome logs these native calls under the same
// client as the WebView instead of a second `[Psysonic]` session.
.user_agent(psysonic_core::user_agent::subsonic_wire_user_agent())
.http1_only() .http1_only()
.pool_max_idle_per_host(0) .pool_max_idle_per_host(0)
.max_tls_version(reqwest::tls::Version::TLS_1_2) .max_tls_version(reqwest::tls::Version::TLS_1_2)
@@ -413,7 +413,10 @@ struct MusicFoldersWrapper {
fn default_http_client() -> reqwest::Client { fn default_http_client() -> reqwest::Client {
reqwest::Client::builder() reqwest::Client::builder()
.user_agent(format!("Psysonic/{} (Tauri)", env!("CARGO_PKG_VERSION"))) // Shared wire UA (aligned with the main WebView at startup) so native
// Subsonic calls share the WebView's client identity on the server
// instead of registering a separate `[Psysonic]` session.
.user_agent(psysonic_core::user_agent::subsonic_wire_user_agent())
.build() .build()
.unwrap_or_else(|_| reqwest::Client::new()) .unwrap_or_else(|_| reqwest::Client::new())
} }