1
0
mirror of https://gitea.farpn.net/w1cdn/mwtchahrd.git synced 2025-10-20 08:24:08 -05:00

Make simple GET request from Spothole.

This commit is contained in:
mattbk
2025-10-18 10:43:56 -05:00
parent ab4f190138
commit 369de6f873
2 changed files with 13 additions and 0 deletions

View File

@ -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<u16, String> {
@ -62,6 +63,11 @@ struct Cli {
/// Spotter callsign (e.g. W1CDN)
#[arg(short = 's', long)]
spotter: Option<String>,
/// 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 {