diff --git a/set_version.sh b/set_version.sh index d053ae30..3671c212 100755 --- a/set_version.sh +++ b/set_version.sh @@ -1,3 +1,3 @@ #!/bin/bash -export version=0.5.2-alpha.0 +export version=0.5.2-alpha.1 echo "pub const VERSION: &str = \"${version}\";" > src/version.rs diff --git a/src/main.rs b/src/main.rs index 1c81376b..d0756e0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,7 @@ use rauth::{ auth::Auth, options::{Template, Templates}, }; +use std::str::FromStr; use rocket_cors::AllowedOrigins; use rocket::catchers; use util::variables::{ @@ -69,6 +70,20 @@ async fn main() { async fn launch_web() { let cors = rocket_cors::CorsOptions { allowed_origins: AllowedOrigins::All, + allowed_methods: [ + "Get", + "Put", + "Post", + "Delete", + "Options", + "Head", + "Trace", + "Connect", + "Patch", + ] + .iter() + .map(|s| FromStr::from_str(s).unwrap()) + .collect(), ..Default::default() } .to_cors() diff --git a/src/routes/users/add_friend.rs b/src/routes/users/add_friend.rs index b0f3e620..40e0d024 100644 --- a/src/routes/users/add_friend.rs +++ b/src/routes/users/add_friend.rs @@ -36,6 +36,9 @@ pub async fn req(user: User, username: String) -> Result { })?; let target_user = Ref::from(target_id.to_string())?.fetch_user().await?; + if target_user.bot.is_some() { + return Err(Error::IsBot) + } match get_relationship(&user, &target_id) { RelationshipStatus::User => return Err(Error::NoEffect), diff --git a/src/version.rs b/src/version.rs index 070fe35a..3b0322fe 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "0.5.2-alpha.0"; +pub const VERSION: &str = "0.5.2-alpha.1";