Skip to content

Commit ce1ab8f

Browse files
committed
refactor: update dependencies and code for latest ecosystem changes
- Update many dependencies to latest versions across all crates - Switch from `once_cell::OnceCell` to `std::sync::OnceLock` where appropriate - Update OAuth to use stateful `reqwest` for HTTP requests - Fix Rodio backend to honor the requested sample format
1 parent 1d5c0d8 commit ce1ab8f

25 files changed

Lines changed: 1642 additions & 1185 deletions

File tree

Cargo.lock

Lines changed: 1333 additions & 1003 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,25 @@ version = "0.6.0-dev"
5656

5757
[dependencies]
5858
data-encoding = "2.5"
59-
env_logger = { version = "0.11.2", default-features = false, features = ["color", "humantime", "auto-color"] }
59+
env_logger = { version = "0.11.2", default-features = false, features = [
60+
"color",
61+
"humantime",
62+
"auto-color",
63+
] }
6064
futures-util = { version = "0.3", default-features = false }
6165
getopts = "0.2"
6266
log = "0.4"
6367
sha1 = "0.10"
64-
sysinfo = { version = "0.33.0", default-features = false, features = ["system"] }
65-
thiserror = "2.0"
66-
tokio = { version = "1.40", features = ["rt", "macros", "signal", "sync", "parking_lot", "process"] }
68+
sysinfo = { version = "0.37", default-features = false, features = ["system"] }
69+
thiserror = "2"
70+
tokio = { version = "1", features = [
71+
"rt",
72+
"macros",
73+
"signal",
74+
"sync",
75+
"parking_lot",
76+
"process",
77+
] }
6778
url = "2.2"
6879

6980
[features]
@@ -97,9 +108,21 @@ available in the official library."""
97108
section = "sound"
98109
priority = "optional"
99110
assets = [
100-
["target/release/librespot", "usr/bin/", "755"],
101-
["contrib/librespot.service", "lib/systemd/system/", "644"],
102-
["contrib/librespot.user.service", "lib/systemd/user/", "644"]
111+
[
112+
"target/release/librespot",
113+
"usr/bin/",
114+
"755",
115+
],
116+
[
117+
"contrib/librespot.service",
118+
"lib/systemd/system/",
119+
"644",
120+
],
121+
[
122+
"contrib/librespot.user.service",
123+
"lib/systemd/user/",
124+
"644",
125+
],
103126
]
104127

105128
[workspace.package]

audio/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ aes = "0.8"
1717
bytes = "1"
1818
ctr = "0.9"
1919
futures-util = "0.3"
20-
hyper = { version = "1.3", features = [] }
20+
hyper = "1.6"
2121
hyper-util = { version = "0.1", features = ["client"] }
22-
http-body-util = "0.1.1"
22+
http-body-util = "0.1"
2323
log = "0.4"
2424
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
2525
tempfile = "3"
26-
thiserror = "2.0"
26+
thiserror = "2"
2727
tokio = { version = "1", features = ["macros", "parking_lot", "sync"] }

connect/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ edition = "2021"
1111
[dependencies]
1212
futures-util = "0.3"
1313
log = "0.4"
14-
protobuf = "3.5"
15-
rand = { version = "0.8", default-features = false, features = ["small_rng"] }
14+
protobuf = "3.7"
15+
rand = { version = "0.9", default-features = false, features = ["small_rng"] }
1616
serde_json = "1.0"
17-
thiserror = "2.0"
17+
thiserror = "2"
1818
tokio = { version = "1", features = ["macros", "parking_lot", "sync"] }
1919
tokio-stream = "0.1"
20-
uuid = { version = "1.11.0", features = ["v4"] }
20+
uuid = { version = "1.18", features = ["v4"] }
2121

2222
[dependencies.librespot-core]
2323
path = "../core"

connect/src/shuffle_vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<T> ShuffleVec<T> {
5858
let indices: Vec<_> = {
5959
(1..self.vec.len())
6060
.rev()
61-
.map(|i| rng.gen_range(0..i + 1))
61+
.map(|i| rng.random_range(0..i + 1))
6262
.collect()
6363
};
6464

@@ -89,7 +89,7 @@ mod test {
8989

9090
#[test]
9191
fn test_shuffle_with_seed() {
92-
let seed = rand::thread_rng().gen_range(0..10000000000000);
92+
let seed = rand::rng().random_range(0..10000000000000);
9393

9494
let vec = (0..100).collect::<Vec<_>>();
9595
let base_vec: ShuffleVec<i32> = vec.into();

connect/src/state/options.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ impl ConnectState {
6868
// we don't need to include the current track, because it is already being played
6969
ctx.skip_track = current_track;
7070

71-
let seed = seed
72-
.unwrap_or_else(|| rand::thread_rng().gen_range(100_000_000_000..1_000_000_000_000));
71+
let seed =
72+
seed.unwrap_or_else(|| rand::rng().random_range(100_000_000_000..1_000_000_000_000));
7373

7474
ctx.tracks.shuffle_with_seed(seed);
7575
ctx.set_shuffle_seed(seed);

connect/src/state/tracks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'ct> ConnectState {
6969

7070
pub fn set_current_track_random(&mut self) -> Result<(), Error> {
7171
let max_tracks = self.get_context(self.active_context)?.tracks.len();
72-
let rng_track = rand::thread_rng().gen_range(0..max_tracks);
72+
let rng_track = rand::rng().random_range(0..max_tracks);
7373
self.set_current_track(rng_track)
7474
}
7575

core/Cargo.toml

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,64 +20,104 @@ version = "0.6.0-dev"
2020
[dependencies]
2121
aes = "0.8"
2222
base64 = "0.22"
23-
byteorder = "1.4"
23+
byteorder = "1.5"
2424
bytes = "1"
25-
form_urlencoded = "1.0"
25+
form_urlencoded = "1.2"
2626
futures-core = "0.3"
27-
futures-util = { version = "0.3", features = ["alloc", "bilock", "sink", "unstable"] }
28-
governor = { version = "0.8", default-features = false, features = ["std", "jitter"] }
27+
futures-util = { version = "0.3", features = [
28+
"alloc",
29+
"bilock",
30+
"sink",
31+
"unstable",
32+
] }
33+
governor = { version = "0.10", default-features = false, features = [
34+
"std",
35+
"jitter",
36+
] }
2937
hmac = "0.12"
30-
httparse = "1.7"
31-
http = "1.0"
32-
hyper = { version = "1.3", features = ["http1", "http2"] }
38+
httparse = "1.10"
39+
http = "1.3"
40+
hyper = { version = "1.6", features = ["http1", "http2"] }
3341
hyper-util = { version = "0.1", features = ["client"] }
34-
http-body-util = "0.1.1"
42+
http-body-util = "0.1"
3543
log = "0.4"
3644
nonzero_ext = "0.3"
37-
num-bigint = { version = "0.4", features = ["rand"] }
45+
num-bigint = "0.4"
3846
num-derive = "0.4"
3947
num-integer = "0.1"
4048
num-traits = "0.2"
41-
once_cell = "1"
4249
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
4350
pbkdf2 = { version = "0.12", default-features = false, features = ["hmac"] }
4451
pin-project-lite = "0.2"
45-
priority-queue = "2.0"
46-
protobuf = "3.5"
47-
quick-xml = { version = "0.37.1", features = ["serialize"] }
48-
rand = "0.8"
49-
rsa = "0.9.2"
52+
priority-queue = "2.5"
53+
protobuf = "3.7"
54+
quick-xml = { version = "0.38", features = ["serialize"] }
55+
rand = "0.9"
56+
rsa = "0.9"
5057
serde = { version = "1.0", features = ["derive"] }
5158
serde_json = "1.0"
5259
sha1 = { version = "0.10", features = ["oid"] }
5360
shannon = "0.2"
54-
sysinfo = { version = "0.33.0", default-features = false, features = ["system"] }
55-
thiserror = "2.0"
61+
sysinfo = { version = "0.37", default-features = false, features = ["system"] }
62+
thiserror = "2"
5663
time = { version = "0.3", features = ["formatting", "parsing"] }
57-
tokio = { version = "1", features = ["io-util", "macros", "net", "parking_lot", "rt", "sync", "time"] }
64+
tokio = { version = "1", features = [
65+
"io-util",
66+
"macros",
67+
"net",
68+
"parking_lot",
69+
"rt",
70+
"sync",
71+
"time",
72+
] }
5873
tokio-stream = "0.1"
5974
tokio-util = { version = "0.7", features = ["codec"] }
6075
url = "2"
61-
uuid = { version = "1", default-features = false, features = ["fast-rng", "v4"] }
62-
data-encoding = "2.5"
63-
flate2 = "1.0.33"
64-
protobuf-json-mapping = "3.5"
76+
uuid = { version = "1", default-features = false, features = ["v4"] }
77+
data-encoding = "2.9"
78+
flate2 = "1.1"
79+
protobuf-json-mapping = "3.7"
6580

6681
# Eventually, this should use rustls-platform-verifier to unify the platform-specific dependencies
6782
# but currently, hyper-proxy2 and tokio-tungstenite do not support it.
6883
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies]
69-
hyper-proxy2 = { version = "0.1", default-features = false, features = ["rustls"] }
70-
hyper-rustls = { version = "0.27.2", default-features = false, features = ["aws-lc-rs", "http1", "logging", "tls12", "native-tokio", "http2"] }
71-
tokio-tungstenite = { version = "0.24", default-features = false, features = ["rustls-tls-native-roots"] }
84+
hyper-proxy2 = { version = "0.1", default-features = false, features = [
85+
"rustls",
86+
] }
87+
hyper-rustls = { version = "0.27", default-features = false, features = [
88+
"aws-lc-rs",
89+
"http1",
90+
"logging",
91+
"tls12",
92+
"native-tokio",
93+
"http2",
94+
] }
95+
tokio-tungstenite = { version = "0.27", default-features = false, features = [
96+
"rustls-tls-native-roots",
97+
] }
7298

7399
[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))'.dependencies]
74-
hyper-proxy2 = { version = "0.1", default-features = false, features = ["rustls-webpki"] }
75-
hyper-rustls = { version = "0.27.2", default-features = false, features = ["aws-lc-rs", "http1", "logging", "tls12", "webpki-tokio", "http2"] }
76-
tokio-tungstenite = { version = "0.24", default-features = false, features = ["rustls-tls-webpki-roots"] }
100+
hyper-proxy2 = { version = "0.1", default-features = false, features = [
101+
"rustls-webpki",
102+
] }
103+
hyper-rustls = { version = "0.27", default-features = false, features = [
104+
"aws-lc-rs",
105+
"http1",
106+
"logging",
107+
"tls12",
108+
"webpki-tokio",
109+
"http2",
110+
] }
111+
tokio-tungstenite = { version = "0.27", default-features = false, features = [
112+
"rustls-tls-webpki-roots",
113+
] }
77114

78115
[build-dependencies]
79-
rand = "0.8"
80-
vergen-gitcl = { version = "1.0.0", default-features = false, features = ["build"] }
116+
rand = "0.9"
117+
rand_distr = "0.5"
118+
vergen-gitcl = { version = "1.0", default-features = false, features = [
119+
"build",
120+
] }
81121

82122
[dev-dependencies]
83123
tokio = { version = "1", features = ["macros", "parking_lot"] }

core/build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use rand::{distributions::Alphanumeric, Rng};
1+
use rand::Rng;
2+
use rand_distr::Alphanumeric;
23
use vergen_gitcl::{BuildBuilder, Emitter, GitclBuilder};
34

45
fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -18,7 +19,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
1819
.expect("Unable to generate the cargo keys!");
1920
let build_id = match std::env::var("SOURCE_DATE_EPOCH") {
2021
Ok(val) => val,
21-
Err(_) => rand::thread_rng()
22+
Err(_) => rand::rng()
2223
.sample_iter(Alphanumeric)
2324
.take(8)
2425
.map(char::from)

core/src/connection/handshake.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{env::consts::ARCH, io};
33
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
44
use hmac::{Hmac, Mac};
55
use protobuf::Message;
6-
use rand::{thread_rng, RngCore};
6+
use rand::RngCore;
77
use rsa::{BigUint, Pkcs1v15Sign, RsaPublicKey};
88
use sha1::{Digest, Sha1};
99
use thiserror::Error;
@@ -49,7 +49,7 @@ pub enum HandshakeError {
4949
pub async fn handshake<T: AsyncRead + AsyncWrite + Unpin>(
5050
mut connection: T,
5151
) -> io::Result<Framed<T, ApCodec>> {
52-
let local_keys = DhLocalKeys::random(&mut thread_rng());
52+
let local_keys = DhLocalKeys::random(&mut rand::rng());
5353
let gc = local_keys.public_key();
5454
let mut accumulator = client_hello(&mut connection, gc).await?;
5555
let message: APResponseMessage = recv_packet(&mut connection, &mut accumulator).await?;
@@ -108,7 +108,7 @@ where
108108
T: AsyncWrite + Unpin,
109109
{
110110
let mut client_nonce = vec![0; 0x10];
111-
thread_rng().fill_bytes(&mut client_nonce);
111+
rand::rng().fill_bytes(&mut client_nonce);
112112

113113
let platform = match crate::config::OS {
114114
"freebsd" | "netbsd" | "openbsd" => match ARCH {

0 commit comments

Comments
 (0)