From ba8ec55345a59ae31d552f2d61897a490e5631a1 Mon Sep 17 00:00:00 2001 From: DaXcess Date: Mon, 1 Jul 2024 15:38:50 +0200 Subject: [PATCH] Fix spotify version in client token request --- core/src/spclient.rs | 4 ++-- core/src/version.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/spclient.rs b/core/src/spclient.rs index 5a41d148..156cf9c8 100644 --- a/core/src/spclient.rs +++ b/core/src/spclient.rs @@ -35,7 +35,7 @@ use crate::{ extended_metadata::BatchedEntityRequest, }, token::Token, - version::spotify_version, + version::spotify_semantic_version, Error, FileId, SpotifyId, }; @@ -182,7 +182,7 @@ impl SpClient { let client_data = request.mut_client_data(); - client_data.client_version = spotify_version(); + client_data.client_version = spotify_semantic_version(); // Current state of affairs: keymaster ID works on all tested platforms, but may be phased out, // so it seems a good idea to mimick the real clients. `self.session().client_id()` returns the diff --git a/core/src/version.rs b/core/src/version.rs index 332761b2..d3870473 100644 --- a/core/src/version.rs +++ b/core/src/version.rs @@ -29,6 +29,13 @@ pub const SPOTIFY_MOBILE_VERSION: &str = "8.6.84"; pub const FALLBACK_USER_AGENT: &str = "Spotify/117300517 Linux/0 (librespot)"; pub fn spotify_version() -> String { + match std::env::consts::OS { + "android" | "ios" => SPOTIFY_MOBILE_VERSION.to_owned(), + _ => SPOTIFY_VERSION.to_string(), + } +} + +pub fn spotify_semantic_version() -> String { match std::env::consts::OS { "android" | "ios" => SPOTIFY_MOBILE_VERSION.to_owned(), _ => SPOTIFY_SEMANTIC_VERSION.to_string(),