diff --git a/src/controllers/routes.rs b/src/controllers/routes.rs index 1572d3c..c94f02a 100644 --- a/src/controllers/routes.rs +++ b/src/controllers/routes.rs @@ -95,6 +95,7 @@ pub fn get_routes() -> Vec { // Settings controller Route::post("/settings/get_general", Box::new(settings_controller::get_general)), Route::post("/settings/set_general", Box::new(settings_controller::set_general)), + Route::post("/settings/check_user_directory_availability", Box::new(settings_controller::check_virtual_directory)), // Friends controller Route::post("/friends/getList", Box::new(friends_controller::get_list)), diff --git a/src/controllers/settings_controller.rs b/src/controllers/settings_controller.rs index abfcaf3..8c7d905 100644 --- a/src/controllers/settings_controller.rs +++ b/src/controllers/settings_controller.rs @@ -47,4 +47,12 @@ pub fn set_general(r: &mut HttpRequestHandler) -> RequestResult { account_helper::set_general(&new_settings)?; r.success("Settings updated") +} + +/// Check the availability of a virtual directory +pub fn check_virtual_directory(r: &mut HttpRequestHandler) -> RequestResult { + // We can do this check just by getting it, there is no need to store it in a variable + r.post_checked_virtual_directory_opt("directory", r.user_id()?.id(), VirtualDirType::USER)?; + + r.success("The directory is available!") } \ No newline at end of file