mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Add user agent to quickinstall stats report
This commit is contained in:
parent
6faa9f8129
commit
d3f8802514
1 changed files with 7 additions and 1 deletions
|
@ -8,6 +8,7 @@ use crate::{download, remote_exists, PkgFmt};
|
||||||
|
|
||||||
const BASE_URL: &str = "https://github.com/alsuren/cargo-quickinstall/releases/download";
|
const BASE_URL: &str = "https://github.com/alsuren/cargo-quickinstall/releases/download";
|
||||||
const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate";
|
const STATS_URL: &str = "https://warehouse-clerk-tmp.vercel.app/api/crate";
|
||||||
|
const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
pub struct QuickInstall {
|
pub struct QuickInstall {
|
||||||
package: String,
|
package: String,
|
||||||
|
@ -61,7 +62,12 @@ impl QuickInstall {
|
||||||
|
|
||||||
pub async fn report(&self) -> Result<(), anyhow::Error> {
|
pub async fn report(&self) -> Result<(), anyhow::Error> {
|
||||||
info!("Sending installation report to quickinstall (anonymous)");
|
info!("Sending installation report to quickinstall (anonymous)");
|
||||||
remote_exists(&self.stats_url(), Method::HEAD).await?;
|
reqwest::Client::builder()
|
||||||
|
.user_agent(USER_AGENT)
|
||||||
|
.build()?
|
||||||
|
.request(Method::HEAD, &self.stats_url())
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue