Skip to content

Commit

Permalink
Add root redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Mubelotix committed Aug 20, 2024
1 parent 8e66e22 commit b5e5842
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub use std::{collections::HashSet, io::Cursor};
pub use isahc::ReadResponseExt;
pub use jsonwebtoken::{Algorithm, DecodingKey, EncodingKey, Validation};
use rocket::{response::Redirect, uri};
pub use serde::{Serialize, Deserialize};
pub use rocket::{get, http::{CookieJar, Header, Status}, launch, response::Responder, routes, Response, State};
pub use string_tools::{get_all_after, get_all_between_strict};
Expand Down Expand Up @@ -50,6 +51,11 @@ pub fn now() -> u64 {
SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs()
}

#[get("/")]
fn root() -> Redirect {
Redirect::to(uri!("https://github.com/INSAgenda/insa-lol"))
}

#[launch]
fn rocket() -> _ {
let private_key = std::fs::read("private.pem").expect("Failed to read private key");
Expand All @@ -58,5 +64,5 @@ fn rocket() -> _ {
let decoding_key: DecodingKey = DecodingKey::from_ec_pem(&public_key).expect("Invalid public key");
rocket::build()
.manage((encoding_key, decoding_key))
.mount("/", routes![login_callback, verify, login, provider_login, provider_validate])
.mount("/", routes![root, login_callback, verify, login, provider_login, provider_validate])
}

0 comments on commit b5e5842

Please sign in to comment.