2020-02-16 00:42:21 +03:00
|
|
|
#![feature(proc_macro_hygiene, decl_macro)]
|
2020-04-09 21:47:03 +03:00
|
|
|
|
2020-04-11 10:30:11 +03:00
|
|
|
mod client_server;
|
2020-03-28 20:50:02 +03:00
|
|
|
mod data;
|
2020-03-30 14:46:18 +03:00
|
|
|
mod database;
|
2020-04-04 12:53:37 +03:00
|
|
|
mod pdu;
|
2020-02-16 00:42:21 +03:00
|
|
|
mod ruma_wrapper;
|
2020-03-29 14:48:44 +03:00
|
|
|
mod utils;
|
2020-02-16 00:42:21 +03:00
|
|
|
|
2020-04-10 14:36:57 +03:00
|
|
|
#[cfg(test)]
|
|
|
|
mod test;
|
|
|
|
|
2020-03-29 01:08:59 +03:00
|
|
|
pub use data::Data;
|
2020-03-30 14:46:18 +03:00
|
|
|
pub use database::Database;
|
2020-04-04 12:53:37 +03:00
|
|
|
pub use pdu::PduEvent;
|
2020-04-11 10:30:11 +03:00
|
|
|
pub use ruma_wrapper::{MatrixResult, Ruma};
|
2020-03-30 14:46:18 +03:00
|
|
|
|
2020-04-11 10:30:11 +03:00
|
|
|
use rocket::routes;
|
2020-04-03 18:27:08 +03:00
|
|
|
|
2020-04-10 14:36:57 +03:00
|
|
|
fn setup_rocket(data: Data) -> rocket::Rocket {
|
2020-02-16 00:42:21 +03:00
|
|
|
rocket::ignite()
|
2020-02-19 00:07:57 +03:00
|
|
|
.mount(
|
|
|
|
"/",
|
|
|
|
routes![
|
2020-04-11 10:30:11 +03:00
|
|
|
client_server::get_supported_versions_route,
|
|
|
|
client_server::register_route,
|
|
|
|
client_server::get_login_route,
|
|
|
|
client_server::login_route,
|
|
|
|
client_server::get_pushrules_all_route,
|
|
|
|
client_server::get_filter_route,
|
|
|
|
client_server::create_filter_route,
|
|
|
|
client_server::set_global_account_data_route,
|
|
|
|
client_server::get_global_account_data_route,
|
|
|
|
client_server::set_displayname_route,
|
|
|
|
client_server::get_displayname_route,
|
|
|
|
client_server::set_avatar_url_route,
|
|
|
|
client_server::get_avatar_url_route,
|
|
|
|
client_server::get_profile_route,
|
|
|
|
client_server::set_presence_route,
|
|
|
|
client_server::get_keys_route,
|
|
|
|
client_server::upload_keys_route,
|
|
|
|
client_server::set_read_marker_route,
|
2020-04-12 22:12:50 +03:00
|
|
|
client_server::create_typing_event_route,
|
2020-04-11 10:30:11 +03:00
|
|
|
client_server::create_room_route,
|
|
|
|
client_server::get_alias_route,
|
|
|
|
client_server::join_room_by_id_route,
|
|
|
|
client_server::join_room_by_id_or_alias_route,
|
2020-04-14 14:54:32 +03:00
|
|
|
client_server::invite_user_route,
|
2020-04-11 10:30:11 +03:00
|
|
|
client_server::get_public_rooms_filtered_route,
|
2020-04-14 14:54:32 +03:00
|
|
|
client_server::search_users_route,
|
2020-04-11 10:30:11 +03:00
|
|
|
client_server::get_protocols_route,
|
|
|
|
client_server::create_message_event_route,
|
|
|
|
client_server::create_state_event_for_key_route,
|
|
|
|
client_server::create_state_event_for_empty_key_route,
|
|
|
|
client_server::sync_route,
|
2020-04-14 14:54:32 +03:00
|
|
|
client_server::turn_server_route,
|
|
|
|
client_server::publicised_groups_route,
|
2020-04-11 10:30:11 +03:00
|
|
|
client_server::options_route,
|
2020-02-19 00:07:57 +03:00
|
|
|
],
|
|
|
|
)
|
2020-03-28 20:50:02 +03:00
|
|
|
.manage(data)
|
2020-04-10 14:36:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Log info by default
|
|
|
|
if let Err(_) = std::env::var("RUST_LOG") {
|
|
|
|
std::env::set_var("RUST_LOG", "matrixserver=debug,info");
|
|
|
|
}
|
|
|
|
pretty_env_logger::init();
|
|
|
|
|
|
|
|
let data = Data::load_or_create("matrixtesting.koesters.xyz");
|
|
|
|
data.debug();
|
|
|
|
|
|
|
|
setup_rocket(data).launch().unwrap();
|
2020-02-16 00:42:21 +03:00
|
|
|
}
|