Skip to content

Commit

Permalink
migrate the rest of the auth endpoints to Axum (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
niamu authored Nov 10, 2023
1 parent cc157da commit 45308f8
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 258 deletions.
244 changes: 0 additions & 244 deletions dim-core/src/routes/invites.rs

This file was deleted.

1 change: 0 additions & 1 deletion dim-core/src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod auth;
pub mod dashboard;
pub mod general;
pub mod host;
pub mod invites;
pub mod library;
pub mod media;
pub mod mediafile;
Expand Down
26 changes: 13 additions & 13 deletions dim-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod tree;
pub use axum;
use axum::extract::{ConnectInfo, State};
use axum::response::Response;
use axum::routing::{get, post};
use axum::routing::{get, post, delete};
use axum::Router;

use dim_core::core::EventTx;
Expand Down Expand Up @@ -253,6 +253,18 @@ pub async fn start_webserver(
"/api/v1/auth/whoami",
get(routes::auth::whoami).with_state(conn.clone()),
)
.route(
"/api/v1/auth/invites",
get(routes::auth::get_all_invites).with_state(conn.clone()),
)
.route(
"/api/v1/auth/new_invite",
post(routes::auth::generate_invite).with_state(conn.clone()),
)
.route(
"/api/v1/auth/token/:token",
delete(routes::auth::delete_token).with_state(conn.clone()),
)
.route_layer(axum::middleware::from_fn_with_state(
conn.clone(),
verify_cookie_token,
Expand Down Expand Up @@ -324,18 +336,6 @@ pub async fn start_webserver(
.or(dim_core::routes::user::filters::upload_avatar(conn.clone()))
}),
)
.route_service(
"/api/v1/auth/*path",
warp::service({
dim_core::routes::invites::filters::get_all_invites(conn.clone())
.or(dim_core::routes::invites::filters::generate_invite(
conn.clone(),
))
.or(dim_core::routes::invites::filters::delete_token(
conn.clone(),
))
}),
)
.route_service(
"/",
warp::service(dim_core::routes::statik::filters::react_routes()),
Expand Down
Loading

0 comments on commit 45308f8

Please sign in to comment.