From d171374aa120bc375aabdf9715e6f5f0ccfc3c21 Mon Sep 17 00:00:00 2001 From: Paul Makles <paulmakles@gmail.com> Date: Mon, 28 Dec 2020 13:40:37 +0000 Subject: [PATCH] Use master branch, ignore local db, and use CORS. --- .gitignore | 1 + Cargo.lock | 2 +- Cargo.toml | 8 ++++---- src/main.rs | 4 +++- src/routes/root.rs | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 98a7051..22ef502 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Rocket.toml /target **/*.rs.bk +.mongo .env diff --git a/Cargo.lock b/Cargo.lock index 0f727d0..9e7f881 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1960,7 +1960,7 @@ dependencies = [ [[package]] name = "revolt" -version = "0.2.11" +version = "0.3.0-alpha" dependencies = [ "bcrypt", "bitfield", diff --git a/Cargo.toml b/Cargo.toml index 79285f0..23378f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt" -version = "0.2.11" +version = "0.3.0-alpha" authors = ["Paul Makles <paulmakles@gmail.com>"] edition = "2018" @@ -12,9 +12,9 @@ many-to-many = "0.1.2" #rauth = { git = "https://gitlab.insrt.uk/insert/rauth" } hive_pubsub = { version = "0.4.1", features = ["mongo"] } -rocket_cors = { git = "https://github.com/lawliet89/rocket_cors" } -rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket" } -rocket = { git = "https://github.com/SergioBenitez/Rocket", default-features = false } +rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", branch = "master" } +rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", branch = "master" } +rocket = { git = "https://github.com/SergioBenitez/Rocket", branch = "master", default-features = false } mongodb = { version = "1.1.1", features = ["tokio-runtime"], default-features = false } once_cell = "1.4.1" diff --git a/src/main.rs b/src/main.rs index c6f8ac2..1f5d2bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,9 +36,11 @@ async fn main() { ..Default::default() } .to_cors() - .unwrap(); + .expect("Failed to create CORS."); routes::mount(rocket::ignite()) + .mount("/", rocket_cors::catch_all_options_routes()) + .manage(cors.clone()) .attach(cors) .launch() .await diff --git a/src/routes/root.rs b/src/routes/root.rs index cc38e8c..a6fc7f5 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -7,7 +7,7 @@ use mongodb::bson::doc; #[get("/")] pub async fn root() -> Response { Response::Success(json!({ - "revolt": "0.2.11", + "revolt": "0.3.0-alpha", "features": { "registration": !*DISABLE_REGISTRATION, "captcha": { -- GitLab