From 369de6f873ae1a27743b8765b29c54492fa45a36 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 18 Oct 2025 10:43:56 -0500 Subject: [PATCH] Make simple GET request from Spothole. --- Cargo.toml | 1 + src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8e64aae..4516ff0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ authors = ["Chris, N6CTA "] anyhow = "1.0" chrono = "0.4" clap = { version = "4", features = ["derive"] } +reqwest = { version = "0.12.24", features = ["json", "blocking"] } serde_json = "1.0.145" socket2 = "0.5" diff --git a/src/main.rs b/src/main.rs index b2f8f62..5eff6bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use std::net::UdpSocket; use std::net::Ipv4Addr; use serde_json::json; +use reqwest; /// Validate that the provided port string can be parsed into a u16 and is nonzero. fn validate_port(port: &str) -> Result { @@ -62,6 +63,11 @@ struct Cli { /// Spotter callsign (e.g. W1CDN) #[arg(short = 's', long)] spotter: Option, + + /// Spot UI frames to Spothole + #[arg(short = 'o', long, default_value_t = false)] + spothole: bool, + } /// Convert a byte slice into a hex-dump string for debugging purposes. @@ -399,6 +405,12 @@ fn handle_frame(frame: &AgwFrame, cli: &Cli, buffers: &mut BufferManager) { if cli.ui_only && summary != "UI" { return; } + + // If Spothole is enabled + if summary == "UI" && cli.spothole { + let body = reqwest::blocking::get("https://spothole.app/api/v1/spots?limit=1"); + println!("body = {body:?}"); + } // Send UDP if cli.uport != 55555 {