Skip to content

Commit

Permalink
chore: upgrade axum to 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Roardom committed Jan 2, 2025
1 parent ae7e753 commit 1573c05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 39 deletions.
46 changes: 14 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
anyhow = { version = "1.0.0", default-features = true, features = ["std"] }
axum = { version = "0.7.5", default-features = false, features = ["http1", "tokio", "query", "macros", "json"] }
axum = { version = "0.8.0", default-features = false, features = ["http1", "tokio", "query", "macros", "json"] }
chrono = { version = "0.4.22", default-features = false, features = ["serde"] }
dotenvy = { version = "0.15.0", default-features = false }
indexmap = { version = "2.0.0", default-features = false, features = ["std", "serde"] }
Expand Down
3 changes: 0 additions & 3 deletions src/announce.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use axum::{
async_trait,
extract::{ConnectInfo, FromRef, FromRequestParts, Path, State},
http::{
header::{ACCEPT_CHARSET, ACCEPT_LANGUAGE, REFERER, USER_AGENT},
Expand Down Expand Up @@ -101,7 +100,6 @@ pub struct Announce {
pub struct Query<T>(pub T);

/// Extracts the query parameters in the HTTP GET request.
#[async_trait]
impl<S> FromRequestParts<S> for Query<Announce>
where
S: Send + Sync,
Expand Down Expand Up @@ -204,7 +202,6 @@ where

pub struct ClientIp(pub std::net::IpAddr);

#[async_trait]
impl FromRequestParts<Arc<Tracker>> for ClientIp {
type Rejection = AnnounceError;

Expand Down
6 changes: 3 additions & 3 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn routes(state: Arc<Tracker>) -> Router<Arc<Tracker>> {
.nest(
"/announce",
Router::new()
.route("/:passkey", get(announce::announce))
.route("/{passkey}", get(announce::announce))
.nest(
&("/".to_string() + &state.config.apikey),
Router::new()
Expand All @@ -25,12 +25,12 @@ pub fn routes(state: Arc<Tracker>) -> Router<Arc<Tracker>> {
put(tracker::torrent::Map::upsert)
.delete(tracker::torrent::Map::destroy),
)
.route("/torrents/:id", get(tracker::torrent::Map::show))
.route("/torrents/{id}", get(tracker::torrent::Map::show))
.route(
"/users",
put(tracker::user::Map::upsert).delete(tracker::user::Map::destroy),
)
.route("/users/:id", get(tracker::user::Map::show))
.route("/users/{id}", get(tracker::user::Map::show))
.route(
"/groups",
put(tracker::group::Map::upsert).delete(tracker::group::Map::destroy),
Expand Down

0 comments on commit 1573c05

Please sign in to comment.