Skip to content
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

Fix spotify version in client token request #1303

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/spclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::{
extended_metadata::BatchedEntityRequest,
},
token::Token,
version::spotify_version,
version::spotify_semantic_version,
Error, FileId, SpotifyId,
};

Expand Down Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions core/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure which version notation mobile uses, as I currently am not easily able to intercept Spotify communication on mobile. For now I've kept the behavior the same as before d881f46.

_ => SPOTIFY_SEMANTIC_VERSION.to_string(),
Expand Down