couple things

This commit is contained in:
Erica Z 2024-11-01 09:32:20 +01:00
parent 68c256488d
commit 2a87d6d9dc

View file

@ -19,7 +19,8 @@ pub enum Error {
impl From<reqwest::Error> for Error {
fn from(err: reqwest::Error) -> Self {
Self::ReqwestError(err)
// don't print secret salt/token combo
Self::ReqwestError(err.without_url())
}
}
@ -41,6 +42,7 @@ impl Client {
pub fn with_password(url: &str, username: &str, password: &[u8]) -> Result<Self, Error> {
const SALT_BYTES: usize = 8;
// subsonic docs say to generate a salt per request, but that's completely unnecessary
let mut salt = vec![0u8; SALT_BYTES];
openssl::rand::rand_bytes(&mut salt).expect("could not generate random salt");
let salt_hex = to_hex_str(&salt);