diff --git a/config/default.toml b/config/default.toml index 899c0e09..d022f00c 100644 --- a/config/default.toml +++ b/config/default.toml @@ -11,7 +11,7 @@ cookie_secret = "Zae0OOxf^bOJ#zN^&k7VozgW&QAx%n02TQFXpRMG4cCU0xMzgu3dna@tQ9dvc&T # The port at which you want authentication to listen to # takes a number, choose from 1000-10000 if you dont know what you are doing port = 7000 -#IP address. Enter 0.0.0.0 to listen on all availale addresses +#IP address. Enter 0.0.0.0 to listen on all available addresses ip= "0.0.0.0" # enter your hostname, eg: example.com domain = "localhost" diff --git a/db/db-core/src/lib.rs b/db/db-core/src/lib.rs index 167eb649..8c33d95f 100644 --- a/db/db-core/src/lib.rs +++ b/db/db-core/src/lib.rs @@ -26,7 +26,7 @@ //! //! ## Organisation //! -//! Database functionallity is divided accross various modules: +//! Database functionality is divided across various modules: //! //! - [errors](crate::auth): error data structures used in this crate //! - [ops](crate::ops): meta operations like connection pool creation, migrations and getting @@ -242,13 +242,13 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase { /// record PoWConfig confirms async fn record_confirm(&self, key: &str) -> DBResult<()>; - /// featch PoWConfig fetches + /// fetch PoWConfig fetches async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult>; - /// featch PoWConfig solves + /// fetch PoWConfig solves async fn fetch_solve(&self, user: &str, key: &str) -> DBResult>; - /// featch PoWConfig confirms + /// fetch PoWConfig confirms async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult>; } @@ -287,7 +287,7 @@ pub struct AddNotification<'a> { pub from: &'a str, /// heading of the notification pub heading: &'a str, - /// mesage of the notification + /// message of the notification pub message: &'a str, } @@ -298,12 +298,12 @@ pub struct TrafficPattern { pub avg_traffic: u32, /// the peak traffic that the user's website can handle pub peak_sustainable_traffic: u32, - /// trafic that bought the user's website down; optional + /// traffic that bought the user's website down; optional pub broke_my_site_traffic: Option, } #[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] -/// data requried to create new captcha +/// data required to create new captcha pub struct CreateCaptcha<'a> { /// cool down duration pub duration: i32, diff --git a/db/db-core/src/ops.rs b/db/db-core/src/ops.rs index 680225a9..f227147a 100644 --- a/db/db-core/src/ops.rs +++ b/db/db-core/src/ops.rs @@ -30,7 +30,7 @@ pub trait GetConnection { async fn get_conn(&self) -> DBResult; } -/// Create databse connection +/// Create database connection #[async_trait] pub trait Connect { /// database specific pool-type diff --git a/db/db-core/src/tests.rs b/db/db-core/src/tests.rs index 5bed3320..2ca6786b 100644 --- a/db/db-core/src/tests.rs +++ b/db/db-core/src/tests.rs @@ -33,7 +33,7 @@ pub async fn database_works<'a, T: MCDatabase>( db.delete_user(p.username).await.unwrap(); assert!( !db.username_exists(p.username).await.unwrap(), - "user is deleted so username shouldn't exsit" + "user is deleted so username shouldn't exist" ); } @@ -89,11 +89,11 @@ pub async fn database_works<'a, T: MCDatabase>( // testing email exists assert!( db.email_exists(p.email.as_ref().unwrap()).await.unwrap(), - "user is registered so email should exsit" + "user is registered so email should exist" ); assert!( db.username_exists(p.username).await.unwrap(), - "user is registered so username should exsit" + "user is registered so username should exist" ); // update password test. setting password = username @@ -124,7 +124,7 @@ pub async fn database_works<'a, T: MCDatabase>( db.delete_user(p.email.as_ref().unwrap()).await.unwrap(); assert!( !db.username_exists(p.email.as_ref().unwrap()).await.unwrap(), - "user is deleted so username shouldn't exsit" + "user is deleted so username shouldn't exist" ); // register with email = None @@ -133,11 +133,11 @@ pub async fn database_works<'a, T: MCDatabase>( db.register(&p2).await.unwrap(); assert!( db.username_exists(p2.username).await.unwrap(), - "user is registered so username should exsit" + "user is registered so username should exist" ); assert!( !db.email_exists(p.email.as_ref().unwrap()).await.unwrap(), - "user registration with email is deleted; so email shouldn't exsit" + "user registration with email is deleted; so email shouldn't exist" ); // testing get_email = None @@ -155,7 +155,7 @@ pub async fn database_works<'a, T: MCDatabase>( ); assert!( db.email_exists(p.email.as_ref().unwrap()).await.unwrap(), - "user was with empty email but email is set; so email should exsit" + "user was with empty email but email is set; so email should exist" ); /* diff --git a/db/db-sqlx-maria/src/lib.rs b/db/db-sqlx-maria/src/lib.rs index 38be17aa..5d7d6809 100644 --- a/db/db-sqlx-maria/src/lib.rs +++ b/db/db-sqlx-maria/src/lib.rs @@ -35,7 +35,7 @@ pub struct Database { /// Use an existing database pool pub struct Conn(pub MySqlPool); -/// Connect to databse +/// Connect to database pub enum ConnectionOptions { /// fresh connection Fresh(Fresh), @@ -824,7 +824,7 @@ impl MCDatabase for Database { Ok(()) } - /// featch PoWConfig fetches + /// fetch PoWConfig fetches async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, @@ -850,7 +850,7 @@ impl MCDatabase for Database { Ok(Date::dates_to_unix(records)) } - /// featch PoWConfig solves + /// fetch PoWConfig solves async fn fetch_solve(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, @@ -874,7 +874,7 @@ impl MCDatabase for Database { Ok(Date::dates_to_unix(records)) } - /// featch PoWConfig confirms + /// fetch PoWConfig confirms async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, diff --git a/db/db-sqlx-postgres/src/lib.rs b/db/db-sqlx-postgres/src/lib.rs index 095cc7cb..6149f68d 100644 --- a/db/db-sqlx-postgres/src/lib.rs +++ b/db/db-sqlx-postgres/src/lib.rs @@ -35,7 +35,7 @@ pub struct Database { /// Use an existing database pool pub struct Conn(pub PgPool); -/// Connect to databse +/// Connect to database pub enum ConnectionOptions { /// fresh connection Fresh(Fresh), @@ -830,7 +830,7 @@ impl MCDatabase for Database { Ok(()) } - /// featch PoWConfig fetches + /// fetch PoWConfig fetches async fn fetch_config_fetched(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, @@ -856,7 +856,7 @@ impl MCDatabase for Database { Ok(Date::dates_to_unix(records)) } - /// featch PoWConfig solves + /// fetch PoWConfig solves async fn fetch_solve(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, @@ -880,7 +880,7 @@ impl MCDatabase for Database { Ok(Date::dates_to_unix(records)) } - /// featch PoWConfig confirms + /// fetch PoWConfig confirms async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult> { let records = sqlx::query_as!( Date, diff --git a/src/api/v1/account/test.rs b/src/api/v1/account/test.rs index dd407dd9..a4ef7801 100644 --- a/src/api/v1/account/test.rs +++ b/src/api/v1/account/test.rs @@ -51,7 +51,7 @@ pub async fn uname_email_exists_works(data: ArcData) { let cookies = get_cookie!(signin_resp); let app = get_app!(data).await; - // chech if get user secret works + // check if get user secret works let resp = test::call_service( &app, test::TestRequest::get() @@ -62,7 +62,7 @@ pub async fn uname_email_exists_works(data: ArcData) { .await; assert_eq!(resp.status(), StatusCode::OK); - // chech if get user secret works + // check if get user secret works let resp = test::call_service( &app, test::TestRequest::post() @@ -178,7 +178,7 @@ pub async fn email_udpate_password_validation_del_userworks(data: ArcData) { ) .await; - // wrong password while deleteing account + // wrong password while deleting account let mut payload = Password { password: NAME.into(), }; diff --git a/src/api/v1/auth.rs b/src/api/v1/auth.rs index a0724d34..b320dbc9 100644 --- a/src/api/v1/auth.rs +++ b/src/api/v1/auth.rs @@ -86,7 +86,7 @@ pub mod runners { pub password: String, } - /// returns Ok(()) when everything checks out and the user is authenticated. Erros otherwise + /// returns Ok(()) when everything checks out and the user is authenticated. Errors otherwise pub async fn login_runner(payload: Login, data: &AppData) -> ServiceResult { use argon2_creds::Config; diff --git a/src/api/v1/mcaptcha/easy.rs b/src/api/v1/mcaptcha/easy.rs index 62667ffb..56584dde 100644 --- a/src/api/v1/mcaptcha/easy.rs +++ b/src/api/v1/mcaptcha/easy.rs @@ -56,7 +56,7 @@ pub struct TrafficPatternRequest { pub avg_traffic: u32, /// the peak traffic that the user's website can handle pub peak_sustainable_traffic: u32, - /// trafic that bought the user's website down; optional + /// traffic that bought the user's website down; optional pub broke_my_site_traffic: Option, /// Captcha description pub description: String, diff --git a/src/api/v1/mcaptcha/update.rs b/src/api/v1/mcaptcha/update.rs index 49b598ac..198cc8de 100644 --- a/src/api/v1/mcaptcha/update.rs +++ b/src/api/v1/mcaptcha/update.rs @@ -191,7 +191,7 @@ mod tests { let updated_token: MCaptchaDetails = test::read_body_json(update_token_resp).await; - // get levels with udpated key + // get levels with updated key let get_token_resp = test::call_service( &app, post_request!(&updated_token, ROUTES.captcha.get) @@ -199,7 +199,7 @@ mod tests { .to_request(), ) .await; - // if updated key doesn't exist in databse, a non 200 result will bereturned + // if updated key doesn't exist in database, a non 200 result will bereturned assert_eq!(get_token_resp.status(), StatusCode::OK); // get stats @@ -211,7 +211,7 @@ mod tests { .to_request(), ) .await; - // if updated key doesn't exist in databse, a non 200 result will bereturned + // if updated key doesn't exist in database, a non 200 result will bereturned assert_eq!(get_statis_resp.status(), StatusCode::OK); } } diff --git a/src/api/v1/meta.rs b/src/api/v1/meta.rs index 464da788..24e148ef 100644 --- a/src/api/v1/meta.rs +++ b/src/api/v1/meta.rs @@ -46,7 +46,7 @@ pub mod routes { } } -/// emmits build details of the bninary +/// emits build details of the bninary #[my_codegen::get(path = "crate::V1_API_ROUTES.meta.build_details")] async fn build_details() -> impl Responder { let build = BuildDetails { diff --git a/src/api/v1/notifications/add.rs b/src/api/v1/notifications/add.rs index e6ef4b2d..1e47b68c 100644 --- a/src/api/v1/notifications/add.rs +++ b/src/api/v1/notifications/add.rs @@ -42,7 +42,7 @@ pub async fn add_notification( id: Identity, ) -> ServiceResult { let sender = id.identity().unwrap(); - // TODO handle error where payload.to doesnt exist + // TODO handle error where payload.to doesn't exist let p = AddNotification { from: &sender, @@ -98,7 +98,7 @@ pub mod tests { let msg = AddNotificationRequest { to: NAME2.into(), heading: "Test notification".into(), - message: "Testeing notifications with a dummy message".into(), + message: "Testing notifications with a dummy message".into(), }; let send_notification_resp = test::call_service( diff --git a/src/api/v1/notifications/get.rs b/src/api/v1/notifications/get.rs index ef5ac26d..57211e01 100644 --- a/src/api/v1/notifications/get.rs +++ b/src/api/v1/notifications/get.rs @@ -68,7 +68,7 @@ pub async fn get_notification( id: Identity, ) -> ServiceResult { let receiver = id.identity().unwrap(); - // TODO handle error where payload.to doesnt exist + // TODO handle error where payload.to doesn't exist let notifications = data.db.get_all_unread_notifications(&receiver).await?; let notifications = NotificationResp::from_notifications(notifications); diff --git a/src/api/v1/notifications/mark_read.rs b/src/api/v1/notifications/mark_read.rs index 53dae542..3aeef2fa 100644 --- a/src/api/v1/notifications/mark_read.rs +++ b/src/api/v1/notifications/mark_read.rs @@ -38,7 +38,7 @@ pub async fn mark_read( id: Identity, ) -> ServiceResult { let receiver = id.identity().unwrap(); - // TODO handle error where payload.to doesnt exist + // TODO handle error where payload.to doesn't exist // TODO get payload from path /api/v1/notifications/{id}/read" data.db diff --git a/src/api/v1/pow/verify_pow.rs b/src/api/v1/pow/verify_pow.rs index 223f6653..213c36af 100644 --- a/src/api/v1/pow/verify_pow.rs +++ b/src/api/v1/pow/verify_pow.rs @@ -135,7 +135,7 @@ pub mod tests { // .await; // assert_eq!(pow_config_resp.status(), StatusCode::OK); // I'm not checking for errors because changing work.result triggered - // InssuficientDifficulty, which is possible becuase libmcaptcha calculates + // InssuficientDifficulty, which is possible because libmcaptcha calculates // difficulty with the submitted result. Besides, this endpoint is merely // propagating errors from libmcaptcha and libmcaptcha has tests covering the // pow aspects ¯\_(ツ)_/¯ diff --git a/src/api/v1/pow/verify_token.rs b/src/api/v1/pow/verify_token.rs index 3f9cf58c..bb27b5be 100644 --- a/src/api/v1/pow/verify_token.rs +++ b/src/api/v1/pow/verify_token.rs @@ -47,7 +47,7 @@ impl From for VerifyCaptchaResult { // API keys are mcaptcha actor names -/// route hander that validates a PoW solution token +/// route handler that validates a PoW solution token #[my_codegen::post(path = "V1_API_ROUTES.pow.validate_captcha_token()")] pub async fn validate_captcha_token( payload: web::Json, diff --git a/src/data.rs b/src/data.rs index caf32e38..63575437 100644 --- a/src/data.rs +++ b/src/data.rs @@ -69,7 +69,7 @@ macro_rules! enum_system_wrapper { /// Represents mCaptcha cache and master system. /// When Redis is configured, [SystemGroup::Redis] is used and -/// in its absense, [SystemGroup::Embedded] is used +/// in its absence, [SystemGroup::Embedded] is used pub enum SystemGroup { Embedded(System), Redis(System), diff --git a/src/pages/panel/notifications.rs b/src/pages/panel/notifications.rs index fbe31c01..c3954389 100644 --- a/src/pages/panel/notifications.rs +++ b/src/pages/panel/notifications.rs @@ -71,7 +71,7 @@ const PAGE: &str = "Notifications"; )] pub async fn notifications(data: AppData, id: Identity) -> PageResult { let receiver = id.identity().unwrap(); - // TODO handle error where payload.to doesnt exist + // TODO handle error where payload.to doesn't exist // let mut notifications = runner::get_notification(&data, &receiver).await?; let mut notifications = data.db.get_all_unread_notifications(&receiver).await?; diff --git a/src/settings.rs b/src/settings.rs index f6b6ecb4..d85ed861 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -78,7 +78,7 @@ impl Server { //impl DatabaseBuilder { // #[cfg(not(tarpaulin_include))] // fn extract_database_url(url: &Url) -> Self { -// debug!("Databse name: {}", url.path()); +// debug!("Database name: {}", url.path()); // let mut path = url.path().split('/'); // path.next(); // let name = path.next().expect("no database name").to_string(); @@ -223,7 +223,7 @@ fn set_database_url(s: &mut Config) { .expect("Couldn't access database name") ), ) - .expect("Couldn't set databse url"); + .expect("Couldn't set database url"); } //#[cfg(test)]