You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
conduit/src/main.rs

27 lines
726 B
Rust

4 years ago
#![feature(proc_macro_hygiene, decl_macro)]
mod ruma_wrapper;
use {
rocket::{get, post, routes},
ruma_client_api::r0::account::register,
ruma_wrapper::Ruma,
std::convert::TryInto,
};
#[post("/_matrix/client/r0/register", data = "<body>")]
fn register_route(body: Ruma<register::Request>) -> Ruma<register::Response> {
Ruma(register::Response {
access_token: "42".to_owned(),
home_server: "deprecated".to_owned(),
user_id: "@yourrequestedid:homeserver.com".try_into().unwrap(),
device_id: body.device_id.clone().unwrap_or_default(),
})
}
fn main() {
pretty_env_logger::init();
rocket::ignite()
.mount("/", routes![register_route])
.launch();
}