Skip to content

Commit

Permalink
chore: spelling corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtread committed Jan 28, 2024
1 parent ec38239 commit 2fde8aa
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Default for Config {
pub enum TunnelConfig {
/// Only tunnel players with non "Open" NAT types if the QoS
/// server is set to [`QosServerConfig::Disabled`] this is
/// equivilent to [`TunnelConfig::Always`]
/// equivalent to [`TunnelConfig::Always`]
#[default]
Stricter,
/// Always tunnel connections through the server regardless
Expand Down
2 changes: 1 addition & 1 deletion src/database/entities/leaderboard_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Model {
.order_by_asc(Expr::cust(Self::RANK_COL))
// Offset to the starting position
.offset(start as u64)
// Only take the requested amouont
// Only take the requested amount
.limit(count as u64)
// Inner join on the players table
.join(sea_orm::JoinType::InnerJoin, Relation::Player.def())
Expand Down
6 changes: 3 additions & 3 deletions src/database/entities/player_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use sea_orm::{
use serde::Serialize;
use std::future::Future;

/// Structure for player data stro
/// Structure for player data
#[derive(Serialize, Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "player_data")]
pub struct Model {
Expand Down Expand Up @@ -60,7 +60,7 @@ impl Model {
value: Set(value),
})
.on_conflict(
// Update the valume column if a key already exists
// Update the value column if a key already exists
OnConflict::columns([Column::PlayerId, Column::Key])
.update_column(Column::Value)
.to_owned(),
Expand All @@ -69,7 +69,7 @@ impl Model {
}

/// Bulk inserts a collection of player data for the provided player. Will not handle
/// conflicts so this should only be done on a freshly create player where data doesnt
/// conflicts so this should only be done on a freshly create player where data doesn't
/// already exist
///
/// `db` The database connection
Expand Down
6 changes: 3 additions & 3 deletions src/middleware/association.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures_util::future::BoxFuture;
use hyper::StatusCode;
use std::{future::ready, sync::Arc};

/// Extractor for retireving the association token from a request headers
/// Extractor for retrieving the association token from a request headers
pub struct Association(pub Option<AssociationId>);

/// The HTTP header that contains the association token
Expand All @@ -27,13 +27,13 @@ impl<S> FromRequestParts<S> for Association {
.get::<Arc<Sessions>>()
.expect("Sessions extension missing");

let assocation_id = parts
let association_id = parts
.headers
.get(TOKEN_HEADER)
.and_then(|value| value.to_str().ok())
.and_then(|token| sessions.verify_assoc_token(token).ok());

Box::pin(ready(Ok(Self(assocation_id))))
Box::pin(ready(Ok(Self(association_id))))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/ip_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn try_socket_address(addr: SocketAddr) -> Result<Ipv4Addr, IpAddressError> {
}

/// Error type used by the token checking middleware to handle
/// different errors and create error respones based on them
/// different errors and create error response based on them
#[derive(Debug, Error)]
pub enum IpAddressError {
/// Fallback extraction attempt failed
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use axum::{
response::{IntoResponse, Response},
};

/// Wrapping structure for creating XML respones from
/// Wrapping structure for creating XML response from
/// a string value
pub struct Xml(pub String);

Expand Down
8 changes: 4 additions & 4 deletions src/routes/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub enum AuthError {

/// Provided account credentials were invalid
#[error("Provided credentials are not valid")]
InvalidCredentails,
InvalidCredentials,

/// Provided username was not valid
#[error("Provided username is invalid")]
Expand Down Expand Up @@ -80,14 +80,14 @@ pub async fn login(
// Find a player with the matching email
let player: Player = Player::by_email(&db, &email)
.await?
.ok_or(AuthError::InvalidCredentails)?;
.ok_or(AuthError::InvalidCredentials)?;

// Find the account password or fail if missing one
let player_password: &str = player.password.as_ref().ok_or(AuthError::OriginAccess)?;

// Verify that the password matches
if !verify_password(&password, player_password) {
return Err(AuthError::InvalidCredentails);
return Err(AuthError::InvalidCredentials);
}

let token = sessions.create_token(player.id);
Expand Down Expand Up @@ -154,7 +154,7 @@ impl IntoResponse for AuthError {
fn into_response(self) -> Response {
let status_code = match &self {
Self::Database(_) | Self::PasswordHash(_) => StatusCode::INTERNAL_SERVER_ERROR,
Self::InvalidCredentails | Self::OriginAccess => StatusCode::UNAUTHORIZED,
Self::InvalidCredentials | Self::OriginAccess => StatusCode::UNAUTHORIZED,
Self::EmailTaken | Self::InvalidUsername => StatusCode::BAD_REQUEST,
Self::RegistrationDisabled => StatusCode::FORBIDDEN,
};
Expand Down
4 changes: 2 additions & 2 deletions src/routes/gaw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct AuthQuery {
/// But this implementation just responds with the bare minimum response directly
/// passing the auth key as the session token for further requests
///
/// Note: Many fields here have their values ommitted compared to the
/// Note: Many fields here have their values omitted compared to the
/// actual response. This is because these are not needed to function
/// so not nessicary to implement the fetching
///
Expand Down Expand Up @@ -147,7 +147,7 @@ pub async fn increase_ratings(
/// Retrieves the galaxy at war data and promotions count for
/// the player with the provided ID
///
/// `db` The dataabse connection
/// `db` The database connection
/// `id` The hex ID of the player
async fn get_player_gaw_data(
db: &DatabaseConnection,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/leaderboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct LeaderboardQuery {
count: Option<u8>,
}

/// The different types of respones that can be created
/// The different types of response that can be created
/// from a leaderboard request
#[derive(Serialize)]
pub struct LeaderboardResponse {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/players.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub async fn set_details(
/// PUT /api/players/self/details
///
/// Route for updating the basic account details for the
/// currenlty authenticated account. WIll ignore any fields
/// currently authenticated account. WIll ignore any fields
/// that are already up to date
///
/// `auth` The currently authenticated player
Expand Down
6 changes: 3 additions & 3 deletions src/routes/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{
use tower::Service;

/// Resources embedded from the public data folder such as the
/// dashboard static assets and the content for the ingame store.
/// dashboard static assets and the content for the in-game store.
///
/// Also acts a service for publicly sharing the content
///
Expand Down Expand Up @@ -57,7 +57,7 @@ impl<T> Service<Request<T>> for PublicContent {

// Determine type using extension
let extension: String = match std_path.extension() {
// Extract the extension lossily
// Extract the extension
Some(value) => value.to_string_lossy().to_string(),
// Use the index file when responding to paths (For SPA dashboard support)
None => {
Expand Down Expand Up @@ -97,7 +97,7 @@ impl<T> Service<Request<T>> for PublicContent {

// File exists within binary serve that
if let Some(contents) = Self::get(&path) {
// Create byte reponse from the embedded file
// Create byte response from the embedded file
let mut response = Full::from(contents).into_response();
response
.headers_mut()
Expand Down
2 changes: 1 addition & 1 deletion src/routes/qos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use indoc::formatdoc;
use log::debug;
use serde::Deserialize;

/// Query for the Qualitu Of Service route
/// Query for the Quality Of Service route
#[derive(Deserialize)]
pub struct QosQuery {
/// The port the client is using
Expand Down
2 changes: 1 addition & 1 deletion src/routes/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ pub struct TelemetryMessage {

/// GET /api/server/telemetry
///
/// Handles the incoming telemetry messages recieved
/// Handles the incoming telemetry messages received
/// from Pocket Relay clients
pub async fn submit_telemetry(Json(data): Json<TelemetryMessage>) -> StatusCode {
debug!("[TELEMETRY] {:?}", data);
Expand Down
16 changes: 8 additions & 8 deletions src/services/game/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub type AttrMap = TdfMap<String, String>;
pub struct GamePlayer {
/// Session player
pub player: Arc<Player>,
/// Weak reference to the assocated session
/// Weak reference to the associated session
pub link: WeakSessionLink,
pub notify_handle: SessionNotifyHandle,
/// Networking information for the player
Expand Down Expand Up @@ -173,7 +173,7 @@ impl GamePlayer {
w.tag_str(b"NAME", &self.player.display_name);
// Player ID
w.tag_u32(b"PID", self.player.id);
// Playet network data
// Player network data
w.tag_ref(b"PNET", &self.net.addr);
// Slot ID
w.tag_owned(b"SID", slot);
Expand All @@ -196,7 +196,7 @@ impl GamePlayer {
/// Different results for checking if a game is
/// joinable
pub enum GameJoinableState {
/// Game is currenlty joinable
/// Game is currently joinable
Joinable,
/// Game is full
Full,
Expand Down Expand Up @@ -350,7 +350,7 @@ impl Game {
};

// Remove the tunnel
self.tunnel_service.dissocate_pool(self.id, index as u8);
self.tunnel_service.dissociate_pool(self.id, index as u8);

// Remove the player
let player = self.players.remove(index);
Expand Down Expand Up @@ -413,7 +413,7 @@ impl Game {
return GameJoinableState::Full;
}

// Check ruleset matches
// Check rule set matches
if let Some(rule_set) = rule_set {
if !rule_set.matches(&self.attributes) {
return GameJoinableState::NotMatch;
Expand Down Expand Up @@ -509,12 +509,12 @@ impl Game {
}

/// Notifies the provided player and all other players
/// in the game that they should remove eachother from
/// in the game that they should remove each other from
/// their player data list
fn rem_user_sub(&self, target: &GamePlayer) {
debug!("Removing user subscriptions");

// Unsubscribe all the clients from eachother
// Unsubscribe all the clients from each other
self.players
.iter()
.filter(|other| other.player.id != target.player.id)
Expand All @@ -524,7 +524,7 @@ impl Game {
});
}

/// Modifies the psudo admin list this list doesn't actually exist in
/// Modifies the pseudo admin list this list doesn't actually exist in
/// our implementation but we still need to tell the clients these
/// changes.
///
Expand Down
2 changes: 1 addition & 1 deletion src/services/game/rules.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::services::game::AttrMap;

/// Rulesets are fairly cheap to clone. Rule values are not usually
/// Rule sets are fairly cheap to clone. Rule values are not usually
/// very long.
pub struct RuleSet {
/// Map rule provided in the matchmaking request
Expand Down
10 changes: 5 additions & 5 deletions src/services/retriever/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl OfficialSession {
}

/// Writes a request packet and waits until the response packet is
/// recieved returning the contents of that response packet.
/// received returning the contents of that response packet.
pub async fn request<Req, Res>(
&mut self,
component: u16,
Expand Down Expand Up @@ -344,7 +344,7 @@ impl OfficialSession {
}

/// Writes a request packet and waits until the response packet is
/// recieved returning the contents of that response packet. The
/// received returning the contents of that response packet. The
/// request will have no content
pub async fn request_empty<Res>(&mut self, component: u16, command: u16) -> RetrieverResult<Res>
where
Expand All @@ -356,7 +356,7 @@ impl OfficialSession {
}

/// Writes a request packet and waits until the response packet is
/// recieved returning the raw response packet
/// received returning the raw response packet
pub async fn request_empty_raw(
&mut self,
component: u16,
Expand All @@ -370,8 +370,8 @@ impl OfficialSession {
self.expect_response(&header).await
}

/// Waits for a response packet to be recieved any notification packets
/// that are recieved are handled in the handle_notify function.
/// Waits for a response packet to be received any notification packets
/// that are received are handled in the handle_notify function.
async fn expect_response(&mut self, request: &FireFrame) -> RetrieverResult<Packet> {
loop {
let response = match self.stream.next().await {
Expand Down
Loading

0 comments on commit 2fde8aa

Please sign in to comment.