Skip to content

Commit

Permalink
fix: gluetun port request
Browse files Browse the repository at this point in the history
  • Loading branch information
jensk-dev committed Nov 13, 2024
1 parent c16f643 commit 78a1a94
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ async fn sync_ports(
}
}

#[derive(Debug, serde::Deserialize)]
struct GluetunPort {
port: u16,
}

/// Retrieves the forwarded port from Gluetun.
///
/// # Parameters
Expand All @@ -185,9 +190,8 @@ async fn get_gluetun_port(
.header("X-API-Key", gluetun_api_key.expose_secret())
.send()
.await?;
let text = response.text().await?;
let port: u16 = text.trim().parse()?;
Ok(port)
let gluetun_port: GluetunPort = response.json().await?;
Ok(gluetun_port.port)
}

/// Logs in to qBittorrent's Web API.
Expand Down

0 comments on commit 78a1a94

Please sign in to comment.