implement more routes with default empty responses
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -1,3 +1,3 @@
|
||||
pub mod errors;
|
||||
pub mod r0;
|
||||
pub mod versions;
|
||||
pub mod versions;
|
@ -25,13 +25,14 @@ use ruma::api::client::{
|
||||
|
||||
pub fn routes() -> axum::Router {
|
||||
axum::Router::new()
|
||||
.route("/r0/login", get(get_login).post(post_login))
|
||||
.route("/r0/login", get(get_login_types).post(login))
|
||||
.route("/r0/register", post(post_register))
|
||||
.route("/r0/register/available", get(get_username_available))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
async fn get_login() -> Result<RumaResponse<session::get_login_types::v3::Response>, ApiError> {
|
||||
async fn get_login_types() -> Result<RumaResponse<session::get_login_types::v3::Response>, ApiError>
|
||||
{
|
||||
use session::get_login_types::v3::*;
|
||||
|
||||
Ok(RumaResponse(session::get_login_types::v3::Response::new(
|
||||
@ -40,7 +41,7 @@ async fn get_login() -> Result<RumaResponse<session::get_login_types::v3::Respon
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn post_login(
|
||||
async fn login(
|
||||
Extension(config): Extension<Arc<Config>>,
|
||||
Extension(db): Extension<SqlitePool>,
|
||||
RumaRequest(req): RumaRequest<session::login::v3::IncomingRequest>,
|
||||
@ -118,7 +119,6 @@ async fn post_register(
|
||||
RumaRequest(req): RumaRequest<account::register::v3::IncomingRequest>,
|
||||
) -> Result<RumaResponse<account::register::v3::Response>, ApiError> {
|
||||
use account::register::v3::*;
|
||||
tracing::debug!("Register hit");
|
||||
|
||||
config
|
||||
.enable_registration()
|
||||
@ -179,7 +179,7 @@ async fn post_register(
|
||||
let password = req
|
||||
.password
|
||||
.ok_or("password missing")
|
||||
.map_err(|e| anyhow::anyhow!(e))?;
|
||||
.map_err(|_| RegistrationError::AdditionalAuthenticationInformation)?;
|
||||
let user_id = if let Some(username) = req.username {
|
||||
let user_id = UserId::new(&username, config.server_name())?;
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
use axum::routing::post;
|
||||
|
||||
use crate::api::client_server::errors::api_error::ApiError;
|
||||
use crate::ruma_wrapper::RumaRequest;
|
||||
|
||||
use ruma::api::client::room;
|
||||
|
||||
pub fn routes() -> axum::Router {
|
||||
axum::Router::new()
|
||||
.route("/r0/createRoom", post(post_create_room))
|
||||
.layer(axum::middleware::from_fn(super::authentication_middleware))
|
||||
}
|
||||
async fn post_create_room(
|
||||
RumaRequest(_req): RumaRequest<room::create_room::v3::IncomingRequest>,
|
||||
) -> Result<String, ApiError> {
|
||||
Ok("".into())
|
||||
}
|
@ -13,7 +13,9 @@ use crate::{models::sessions::Session, types::error_code::ErrorCode};
|
||||
use super::errors::ErrorResponse;
|
||||
|
||||
pub mod auth;
|
||||
pub mod create_room;
|
||||
pub mod room;
|
||||
pub mod presence;
|
||||
pub mod push;
|
||||
pub mod thirdparty;
|
||||
|
||||
async fn authentication_middleware<B>(mut req: Request<B>, next: Next<B>) -> impl IntoResponse {
|
||||
|
@ -19,7 +19,6 @@ pub fn routes() -> axum::Router {
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn get_thirdparty_protocols(
|
||||
Extension(_user): Extension<Arc<User>>,
|
||||
RumaRequest(_req): RumaRequest<thirdparty::get_protocols::v3::IncomingRequest>,
|
||||
) -> Result<RumaResponse<thirdparty::get_protocols::v3::Response>, ApiError> {
|
||||
Ok(RumaResponse(thirdparty::get_protocols::v3::Response::new(
|
||||
BTreeMap::new(),
|
||||
|
@ -1,12 +1,12 @@
|
||||
use axum::routing::get;
|
||||
|
||||
use crate::ruma_wrapper::RumaResponse;
|
||||
use ruma::api::client::discovery;
|
||||
|
||||
pub fn routes() -> axum::Router {
|
||||
axum::Router::new().route("/versions", get(get_client_versions))
|
||||
}
|
||||
|
||||
use ruma::api::client::discovery;
|
||||
|
||||
#[tracing::instrument]
|
||||
async fn get_client_versions() -> RumaResponse<discovery::get_supported_versions::Response> {
|
||||
@ -18,4 +18,4 @@ async fn get_client_versions() -> RumaResponse<discovery::get_supported_versions
|
||||
"v1.1".to_owned(),
|
||||
"v1.2".to_owned(),
|
||||
]))
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user