Fix typos
This commit is contained in:
parent
961bb6c5f4
commit
bb42841a66
19 changed files with 43 additions and 43 deletions
|
@ -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"
|
||||
|
|
|
@ -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<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig solves
|
||||
/// fetch PoWConfig solves
|
||||
async fn fetch_solve(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// featch PoWConfig confirms
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
}
|
||||
|
||||
|
@ -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<u32>,
|
||||
}
|
||||
|
||||
#[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,
|
||||
|
|
|
@ -30,7 +30,7 @@ pub trait GetConnection {
|
|||
async fn get_conn(&self) -> DBResult<Self::Conn>;
|
||||
}
|
||||
|
||||
/// Create databse connection
|
||||
/// Create database connection
|
||||
#[async_trait]
|
||||
pub trait Connect {
|
||||
/// database specific pool-type
|
||||
|
|
|
@ -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"
|
||||
);
|
||||
|
||||
/*
|
||||
|
|
|
@ -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<Vec<i64>> {
|
||||
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<Vec<i64>> {
|
||||
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<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
|
|
@ -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<Vec<i64>> {
|
||||
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<Vec<i64>> {
|
||||
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<Vec<i64>> {
|
||||
let records = sqlx::query_as!(
|
||||
Date,
|
||||
|
|
|
@ -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(),
|
||||
};
|
||||
|
|
|
@ -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<String> {
|
||||
use argon2_creds::Config;
|
||||
|
||||
|
|
|
@ -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<u32>,
|
||||
/// Captcha description
|
||||
pub description: String,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -42,7 +42,7 @@ pub async fn add_notification(
|
|||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
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(
|
||||
|
|
|
@ -68,7 +68,7 @@ pub async fn get_notification(
|
|||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
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);
|
||||
|
|
|
@ -38,7 +38,7 @@ pub async fn mark_read(
|
|||
id: Identity,
|
||||
) -> ServiceResult<impl Responder> {
|
||||
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
|
||||
|
|
|
@ -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 ¯\_(ツ)_/¯
|
||||
|
|
|
@ -47,7 +47,7 @@ impl From<VerifyCaptchaResultPayload> 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<VerifyCaptchaResultPayload>,
|
||||
|
|
|
@ -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<HashCache, EmbeddedMaster>),
|
||||
Redis(System<RedisCache, RedisMaster>),
|
||||
|
|
|
@ -71,7 +71,7 @@ const PAGE: &str = "Notifications";
|
|||
)]
|
||||
pub async fn notifications(data: AppData, id: Identity) -> PageResult<impl Responder> {
|
||||
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?;
|
||||
|
|
|
@ -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)]
|
||||
|
|
Loading…
Reference in a new issue