Merge pull request #1303 from DaXcess/clienttoken-ver-fix

Fix spotify version in client token request
This commit is contained in:
Roderick van Domburg 2024-07-01 19:57:46 +02:00 committed by GitHub
commit 299b7dec20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -35,7 +35,7 @@ use crate::{
extended_metadata::BatchedEntityRequest, extended_metadata::BatchedEntityRequest,
}, },
token::Token, token::Token,
version::spotify_version, version::spotify_semantic_version,
Error, FileId, SpotifyId, Error, FileId, SpotifyId,
}; };
@ -182,7 +182,7 @@ impl SpClient {
let client_data = request.mut_client_data(); 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, // 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 // so it seems a good idea to mimick the real clients. `self.session().client_id()` returns the

View file

@ -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 const FALLBACK_USER_AGENT: &str = "Spotify/117300517 Linux/0 (librespot)";
pub fn spotify_version() -> String { 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 { match std::env::consts::OS {
"android" | "ios" => SPOTIFY_MOBILE_VERSION.to_owned(), "android" | "ios" => SPOTIFY_MOBILE_VERSION.to_owned(),
_ => SPOTIFY_SEMANTIC_VERSION.to_string(), _ => SPOTIFY_SEMANTIC_VERSION.to_string(),