1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-03 01:39:28 +02:00

Solve hash cash challenges (experimental)

This commit is contained in:
Roderick van Domburg 2022-08-26 01:51:00 +02:00
parent 42a665fb0d
commit 7b19d4c1dd
No known key found for this signature in database
GPG key ID: 87F5FDE8A56219F4
6 changed files with 138 additions and 37 deletions

View file

@ -15,7 +15,7 @@ use thiserror::Error;
use url::Url;
use crate::{
version::{FALLBACK_USER_AGENT, SPOTIFY_MOBILE_VERSION, SPOTIFY_VERSION, VERSION_STRING},
version::{spotify_version, FALLBACK_USER_AGENT, VERSION_STRING},
Error,
};
@ -82,11 +82,6 @@ pub struct HttpClient {
impl HttpClient {
pub fn new(proxy_url: Option<&Url>) -> Self {
let spotify_version = match OS {
"android" | "ios" => SPOTIFY_MOBILE_VERSION.to_owned(),
_ => SPOTIFY_VERSION.to_string(),
};
let spotify_platform = match OS {
"android" => "Android/31",
"ios" => "iOS/15.2.1",
@ -97,7 +92,9 @@ impl HttpClient {
let user_agent_str = &format!(
"Spotify/{} {} ({})",
spotify_version, spotify_platform, VERSION_STRING
spotify_version(),
spotify_platform,
VERSION_STRING
);
let user_agent = HeaderValue::from_str(user_agent_str).unwrap_or_else(|err| {