Compare commits

..

2 commits

Author SHA1 Message Date
70dffdec73 chore: update dependencies 2023-04-22 00:01:12 +02:00
ae7b890940 chore: update pre-commit config 2023-04-21 23:57:57 +02:00
4 changed files with 23 additions and 17 deletions

View file

@ -3,6 +3,5 @@ repos:
rev: v0.1.0 rev: v0.1.0
hooks: hooks:
- id: cargo-fmt - id: cargo-fmt
- id: cargo-check
- id: cargo-clippy - id: cargo-clippy
args: ["--", "-D", "warnings"] args: ["--all", "--all-features", "--", "-D", "warnings"]

View file

@ -2,7 +2,7 @@
name = "musixmatch-inofficial" name = "musixmatch-inofficial"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
authors = ["ThetaDev"] authors = ["ThetaDev <t.testboy@gmail.com>"]
license = "MIT" license = "MIT"
description = "Inofficial client for the Musixmatch API" description = "Inofficial client for the Musixmatch API"
keywords = ["music", "lyrics"] keywords = ["music", "lyrics"]
@ -21,24 +21,33 @@ rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"] rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"]
[dependencies] [dependencies]
reqwest = {version = "0.11.11", default-features = false, features = ["json", "gzip", "cookies"]} reqwest = { version = "0.11.11", default-features = false, features = [
tokio = {version = "1.20.0"} "json",
"gzip",
"cookies",
] }
tokio = { version = "1.20.0" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.85" serde_json = "1.0.85"
thiserror = "1.0.36" thiserror = "1.0.36"
log = "0.4.17" log = "0.4.17"
time = {version = "0.3.15", features = ["macros", "formatting", "serde", "serde-well-known"]} time = { version = "0.3.15", features = [
"macros",
"formatting",
"serde",
"serde-well-known",
] }
hmac = "0.12.1" hmac = "0.12.1"
sha1 = "0.10.5" sha1 = "0.10.5"
rand = "0.8.5" rand = "0.8.5"
base64 = "0.13.0" base64 = "0.21.0"
[dev-dependencies] [dev-dependencies]
ctor = "0.1.23" ctor = "0.2.0"
rstest = {version = "0.15.0", default-features = false} rstest = { version = "0.17.0", default-features = false }
env_logger = "0.9.1" env_logger = "0.10.0"
dotenvy = "0.15.5" dotenvy = "0.15.5"
tokio = {version = "1.20.0", features = ["macros"]} tokio = { version = "1.20.0", features = ["macros"] }
futures = "0.3.21" futures = "0.3.21"
[profile.release] [profile.release]

View file

@ -415,15 +415,12 @@ fn input(prompt: &str) -> String {
stdin().read_line(&mut input).expect("Failed to read line"); stdin().read_line(&mut input).expect("Failed to read line");
// Remove trailing newline // Remove trailing newline
input.pop(); input.pop();
input
return input;
} }
fn input_pwd(prompt: &str) -> String { fn input_pwd(prompt: &str) -> String {
print!("{}", prompt); print!("{}", prompt);
stdout().flush().expect("Failed to flush stdout!"); stdout().flush().expect("Failed to flush stdout!");
let input = rpassword::read_password().expect("Failed to read password"); rpassword::read_password().expect("Failed to read password")
return input;
} }

View file

@ -13,6 +13,7 @@ use std::sync::{Arc, RwLock};
pub use error::Error; pub use error::Error;
use base64::Engine;
use hmac::{Hmac, Mac}; use hmac::{Hmac, Mac};
use log::{error, info, warn}; use log::{error, info, warn};
use rand::{seq::SliceRandom, Rng}; use rand::{seq::SliceRandom, Rng};
@ -425,7 +426,7 @@ fn sign_url_with_date(url: &mut Url, date: OffsetDateTime) {
mac.update(date.format(YMD_FORMAT).unwrap_or_default().as_bytes()); mac.update(date.format(YMD_FORMAT).unwrap_or_default().as_bytes());
let sig = mac.finalize().into_bytes(); let sig = mac.finalize().into_bytes();
let sig_b64 = base64::encode(sig) + "\n"; let sig_b64 = base64::engine::general_purpose::STANDARD.encode(sig) + "\n";
url.query_pairs_mut() url.query_pairs_mut()
.append_pair("signature", &sig_b64) .append_pair("signature", &sig_b64)