Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
add machine-uid = "0.5.1"
Browse files Browse the repository at this point in the history
add uid to user-agent. (modrinth) #18
  • Loading branch information
TOwInOK committed May 27, 2024
1 parent fc6b032 commit f35f152
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ futures-util = "0.3.30"
indicatif = { version = "0.17.8", features = ["tokio"] }
indicatif-log-bridge = "0.2.2"
log = "0.4.21"
machine-uid = "0.5.1"
md-5 = "0.10.6"
once_cell = "1.19.0"
pretty_env_logger = "0.5.0"
Expand Down
2 changes: 1 addition & 1 deletion src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use tr::load::Load;

pub async fn run() -> Result<()> {
let logger = pretty_env_logger::formatted_builder()
.filter_level(log::LevelFilter::Info)
.filter_level(log::LevelFilter::Trace)
.build();
let (mpb, lock, settings) = init().await?;
let mpb_cloned = mpb.as_ref().clone();
Expand Down
11 changes: 7 additions & 4 deletions src/models/extensions/modrinth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ impl ModelExtensions for ModrinthData {
}
}
};
trace!("query: {:#?}", &query);
let client = reqwest::Client::builder()
.user_agent("TOwInOK/Minecraft-Dependency-Controller ([email protected]) TestPoligon")
.build()?;
trace!(target: "Modrinth", "query: {:#?}", &query);
let user_agent = format!(
"TOwInOK/Minecraft-Dependency-Manager ([email protected]) UID: {}",
machine_uid::get().unwrap()
);
trace!(target: "Modrinth", "User-Agent: {}", &user_agent);
let client = reqwest::Client::builder().user_agent(user_agent).build()?;

let modrinth_data: Vec<ModrinthData> =
client.get(&link).query(&query).send().await?.json().await?;
Expand Down

0 comments on commit f35f152

Please sign in to comment.