diff --git a/blahd/src/main.rs b/blahd/src/main.rs index 7ae5515..f25fd8d 100644 --- a/blahd/src/main.rs +++ b/blahd/src/main.rs @@ -10,7 +10,7 @@ use axum::http::{header, StatusCode}; use axum::response::{IntoResponse, Response}; use axum::routing::{get, post}; use axum::{Json, Router}; -use axum_extra::extract::WithRejection; +use axum_extra::extract::WithRejection as R; use blah::types::{ ChatItem, ChatPayload, CreateRoomPayload, MemberPermission, RoomAdminOp, RoomAdminPayload, RoomAttrs, ServerPermission, Signee, UserKey, WithSig, @@ -171,6 +171,8 @@ async fn main_async(st: AppState) -> Result<()> { Ok(()) } +type RE = R; + async fn handle_ws(State(st): ArcState, ws: WebSocketUpgrade) -> Response { ws.on_upgrade(move |mut socket| async move { match event::handle_ws(st, &mut socket).await { @@ -215,7 +217,7 @@ enum ListRoomFilter { async fn room_list( st: ArcState, - WithRejection(params, _): WithRejection, ApiError>, + params: RE>, auth: MaybeAuth, ) -> Result, ApiError> { let pagination = Pagination { @@ -430,8 +432,8 @@ struct RoomItems { async fn room_get_item( st: ArcState, - WithRejection(Path(ruuid), _): WithRejection, ApiError>, - WithRejection(Query(pagination), _): WithRejection, ApiError>, + R(Path(ruuid), _): RE>, + R(Query(pagination), _): RE>, auth: MaybeAuth, ) -> Result, ApiError> { let (items, skip_token) = { @@ -448,7 +450,7 @@ async fn room_get_item( async fn room_get_metadata( st: ArcState, - WithRejection(Path(ruuid), _): WithRejection, ApiError>, + R(Path(ruuid), _): RE>, auth: MaybeAuth, ) -> Result, ApiError> { let (title, attrs) = @@ -469,8 +471,8 @@ async fn room_get_metadata( async fn room_get_feed( st: ArcState, - WithRejection(Path(ruuid), _): WithRejection, ApiError>, - Query(pagination): Query, + R(Path(ruuid), _): RE>, + R(Query(pagination), _): RE>, ) -> Result { let title; let (items, skip_token) = { @@ -665,7 +667,7 @@ fn query_room_items( async fn room_post_item( st: ArcState, - Path(ruuid): Path, + R(Path(ruuid), _): RE>, SignedJson(chat): SignedJson, ) -> Result, ApiError> { if ruuid != chat.signee.payload.room { @@ -757,7 +759,7 @@ async fn room_post_item( async fn room_admin( st: ArcState, - Path(ruuid): Path, + R(Path(ruuid), _): RE>, SignedJson(op): SignedJson, ) -> Result { if ruuid != op.signee.payload.room {