mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-04 02:59:08 -07:00
Added HTTP GET request to check if uz801 device is online (#648)
Co-authored-by: Your Name <you@example.com> Co-authored-by: Markus Unterwaditzer <markus-tarpit+git@unterwaditzer.net>
This commit is contained in:
@@ -54,6 +54,21 @@ pub async fn activate_usb_debug(admin_ip: &str) -> Result<()> {
|
||||
let referer = format!("http://{admin_ip}/usbdebug.html");
|
||||
let origin = format!("http://{admin_ip}");
|
||||
|
||||
// Check if device is online
|
||||
echo!("Checking if device is online... ");
|
||||
let client = reqwest::Client::builder()
|
||||
.timeout(Duration::from_secs(5))
|
||||
.build()?;
|
||||
|
||||
match client.get(&origin).send().await {
|
||||
Ok(response) if response.status().is_success() => println!("ok"),
|
||||
Ok(response) => anyhow::bail!(
|
||||
"Device at {admin_ip} returned error status: {}",
|
||||
response.status()
|
||||
),
|
||||
Err(e) => anyhow::bail!("Failed to reach device at {admin_ip}: {}", e),
|
||||
}
|
||||
|
||||
let _handle = tokio::spawn(async move {
|
||||
let client = reqwest::Client::builder()
|
||||
.timeout(Duration::from_secs(5))
|
||||
|
||||
Reference in New Issue
Block a user