Skip to content

Commit

Permalink
Merge pull request #4 from Jupeyy/pr_upgrade_deps
Browse files Browse the repository at this point in the history
Update deps
  • Loading branch information
Jupeyy authored Nov 30, 2024
2 parents 394c342 + 106c7ab commit 830316b
Show file tree
Hide file tree
Showing 59 changed files with 1,637 additions and 1,341 deletions.
1,177 changes: 573 additions & 604 deletions Cargo.lock

Large diffs are not rendered by default.

35 changes: 17 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ ddnet-accounts-types = { version = "0.1.0", path = "lib/ddnet-accounts-types" }
ddnet-accounts-shared = { version = "0.1.0", path = "lib/ddnet-accounts-shared" }
ddnet-account-sql = { version = "0.2.0", path = "lib/ddnet-account-sql", features = ["mysql"] }

tokio = { version = "1.39.3", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
axum = "0.7.5"
anyhow = { version = "1.0.86", features = ["backtrace"] }
# https://github.com/launchbadge/sqlx/issues/2636
sqlx = { version = "=0.6.3", features = ["mysql", "any", "runtime-tokio-rustls", "chrono"] }
tokio = { version = "1.41.1", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
axum = "0.7.9"
anyhow = { version = "1.0.93", features = ["backtrace"] }
sqlx = { version = "0.8.2", features = ["mysql", "any", "runtime-tokio-rustls", "chrono"] }
email_address = { version = "0.2.9", features = ["serde"] }
ed25519-dalek = { version = "2.1.1", features = ["serde", "pkcs8"] }
async-trait = "0.1.81"
async-trait = "0.1.83"
argon2 = "0.5.3"
serde_json = "1.0.125"
serde_json = "1.0.133"
parking_lot = "0.12.3"
lettre = "0.11.7"
serde = { version = "1.0.208", features = ["derive"] }
url = { version = "2.5.2", features = ["serde"] }
lettre = "0.11.10"
serde = { version = "1.0.215", features = ["derive"] }
url = { version = "2.5.4", features = ["serde"] }
log = "0.4.22"
clap = { version = "4.5.16", features = ["derive", "cargo"] }
clap = { version = "4.5.21", features = ["derive", "cargo"] }
env_logger = "0.11.5"
rcgen = { version = "0.13.1" }
x509-cert = { version = "0.2.5", features = ["builder"] }
Expand All @@ -52,21 +51,21 @@ rand = { version = "0.8.5", features = ["getrandom"], default-features = false }
sha2 = { version = "0.10", features = ["oid"] }
der = { version = "0.7.9", features = ["derive"] }
chrono = { version = "0.4.38", features = ["serde"] }
tower_governor = "0.4.2"
tower = "0.4.13"
tower_governor = "0.4.3"
tower = "0.5.1"
strum = { version = "0.26.3", features = ["derive"] }
reqwest = { version = "0.12.5" }
reqwest = { version = "0.12.9" }
hex = "0.4.3"
iprange = "0.6.7"
ipnet = "2.9.0"
ipnet = "2.10.1"
either = "1.13.0"
notify = { version = "6.1.1", default-features = false, features = ["macos_kqueue"] }
notify = { version = "7.0.0", default-features = false, features = ["macos_kqueue"] }

[dev-dependencies]
ddnet-account-client = { version = "0.1.0", path = "lib/ddnet-account-client" }
ddnet-account-game-server = { version = "0.2.0", path = "lib/ddnet-account-game-server" }
ddnet-account-client-http-fs = { version = "0.1.0", path = "lib/ddnet-account-client-http-fs" }
ddnet-account-client-reqwest = { version = "0.1.0", path = "lib/ddnet-account-client-reqwest" }

regex = "1.10.6"
tempfile = "3.12.0"
regex = "1.11.1"
tempfile = "3.14.0"
14 changes: 7 additions & 7 deletions lib/ddnet-account-client-http-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ ddnet-accounts-shared = { version = "0.1.0", path = "../ddnet-accounts-shared" }
ddnet-accounts-types = { version = "0.1.0", path = "../ddnet-accounts-types" }
ddnet-account-client = { version = "0.1.0", path = "../ddnet-account-client" }

anyhow = { version = "1.0.86", features = ["backtrace"] }
anyhow = { version = "1.0.93", features = ["backtrace"] }
parking_lot = "0.12.3"
async-trait = "0.1.81"
url = { version = "2.5.2", features = ["serde"] }
tokio = { version = "1.39.3", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
serde = { version = "1.0.208", features = ["derive"] }
serde_json = "1.0.125"
async-trait = "0.1.83"
url = { version = "2.5.4", features = ["serde"] }
tokio = { version = "1.41.1", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
serde = { version = "1.0.215", features = ["derive"] }
serde_json = "1.0.133"
email_address = { version = "0.2.9", features = ["serde"] }
tempfile = "3.12.0"
tempfile = "3.14.0"
x509-cert = { version = "0.2.5" }
either = "1.13.0"
chrono = { version = "0.4.38", features = ["serde"] }
2 changes: 1 addition & 1 deletion lib/ddnet-account-client-http-fs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::{
time::Duration,
};

use anyhow::anyhow;
use ddnet_account_client::{
errors::{FsLikeError, HttpLikeError},
interface::Io,
};
use anyhow::anyhow;
use serde::{Deserialize, Serialize};

use crate::{fs::Fs, http::Http};
Expand Down
2 changes: 1 addition & 1 deletion lib/ddnet-account-client-http-fs/src/http.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::Debug;

use ddnet_account_client::errors::HttpLikeError;
use async_trait::async_trait;
use ddnet_account_client::errors::HttpLikeError;
use url::Url;

#[async_trait]
Expand Down
8 changes: 4 additions & 4 deletions lib/ddnet-account-client-reqwest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/ddnet/ddnet-accounts"
ddnet-account-client-http-fs = { version = "0.1.0", path = "../ddnet-account-client-http-fs" }
ddnet-account-client = { version = "0.1.0", path = "../ddnet-account-client" }

async-trait = "0.1.81"
url = { version = "2.5.2", features = ["serde"] }
reqwest = { version = "0.12.5" }
anyhow = { version = "1.0.86", features = ["backtrace"] }
async-trait = "0.1.83"
url = { version = "2.5.4", features = ["serde"] }
reqwest = { version = "0.12.9" }
anyhow = { version = "1.0.93", features = ["backtrace"] }
12 changes: 6 additions & 6 deletions lib/ddnet-account-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ repository = "https://github.com/ddnet/ddnet-accounts"
ddnet-accounts-shared = { version = "0.1.0", path = "../ddnet-accounts-shared" }
ddnet-accounts-types = { version = "0.1.0", path = "../ddnet-accounts-types" }

async-trait = "0.1.81"
async-trait = "0.1.83"
email_address = { version = "0.2.9", features = ["serde"] }
serde_json = "1.0.125"
anyhow = { version = "1.0.86", features = ["backtrace"] }
thiserror = "1.0.63"
serde = { version = "1.0.208", features = ["derive"] }
serde_json = "1.0.133"
anyhow = { version = "1.0.93", features = ["backtrace"] }
thiserror = "2.0.3"
serde = { version = "1.0.215", features = ["derive"] }
x509-parser = { version = "0.16.0", default-features = false }
x509-cert = { version = "0.2.5" }
hex = "0.4.3"

[dev-dependencies]
pollster = "0.3.0"
pollster = "0.4.0"
2 changes: 1 addition & 1 deletion lib/ddnet-account-client/src/certs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::anyhow;
use ddnet_accounts_shared::{
account_server::certs::AccountServerCertificates, game_server::user_id::VerifyingKey,
};
use anyhow::anyhow;
use x509_cert::{
der::{Decode, Encode},
spki::DecodePublicKey,
Expand Down
8 changes: 4 additions & 4 deletions lib/ddnet-account-client/src/safe_interface.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use anyhow::anyhow;
use async_trait::async_trait;
use ddnet_accounts_shared::{
account_server::{
account_info::AccountInfoResponse, account_token::AccountTokenError,
Expand All @@ -19,8 +21,6 @@ use ddnet_accounts_shared::{
},
};
use ddnet_accounts_types::account_id::AccountId;
use anyhow::anyhow;
use async_trait::async_trait;
use serde::Deserialize;

use crate::{
Expand Down Expand Up @@ -112,7 +112,7 @@ pub struct IoSafe<'a> {
pub io: &'a dyn Io,
}

impl<'a> IoSafe<'a> {
impl IoSafe<'_> {
fn des_from_vec<T>(data: Vec<u8>) -> anyhow::Result<T, HttpLikeError>
where
for<'de> T: Deserialize<'de>,
Expand All @@ -130,7 +130,7 @@ impl<'a> From<&'a dyn Io> for IoSafe<'a> {
}

#[async_trait]
impl<'a> SafeIo for IoSafe<'a> {
impl SafeIo for IoSafe<'_> {
async fn request_credential_auth_email_token(
&self,
data: CredentialAuthTokenEmailRequest,
Expand Down
2 changes: 1 addition & 1 deletion lib/ddnet-account-client/src/sign.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::anyhow;
use ddnet_accounts_shared::client::{
account_data::AccountDataForClient, machine_id::machine_uid, sign::prepare_sign_request,
};
use anyhow::anyhow;
use thiserror::Error;
use x509_parser::oid_registry::asn1_rs::FromDer;

Expand Down
13 changes: 6 additions & 7 deletions lib/ddnet-account-game-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ ddnet-accounts-types = { version = "0.1.0", path = "../ddnet-accounts-types" }
ddnet-accounts-shared = { version = "0.1.0", path = "../ddnet-accounts-shared" }
ddnet-account-sql = { version = "0.2.0", path = "../ddnet-account-sql", default-features = false }

# https://github.com/launchbadge/sqlx/issues/2636
sqlx = { version = "=0.6.3", features = ["any", "runtime-tokio-rustls", "chrono"] }
anyhow = { version = "1.0.86", features = ["backtrace"] }
async-trait = "0.1.81"
thiserror = "1.0.63"
sqlx = { version = "0.8.2", features = ["any", "runtime-tokio-rustls", "chrono"] }
anyhow = { version = "1.0.93", features = ["backtrace"] }
async-trait = "0.1.83"
thiserror = "2.0.3"

[dev-dependencies]
tokio = { version = "1.39.3", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
anyhow = { version = "1.0.86", features = ["backtrace"] }
tokio = { version = "1.41.1", features = ["rt-multi-thread", "sync", "fs", "time", "macros"] }
anyhow = { version = "1.0.93", features = ["backtrace"] }

[features]
mysql = ["ddnet-account-sql/mysql", "sqlx/mysql"]
Expand Down
11 changes: 5 additions & 6 deletions lib/ddnet-account-game-server/src/auto_login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ pub(crate) mod queries;

use std::sync::Arc;

use ddnet_account_sql::query::Query;
use ddnet_account_sql::{any::AnyPool, query::Query};
use ddnet_accounts_shared::game_server::user_id::UserId;
use ddnet_accounts_types::account_id::AccountId;
use sqlx::Acquire;
use thiserror::Error;

use crate::shared::Shared;
Expand Down Expand Up @@ -42,15 +41,15 @@ pub fn default_name(account_id: &AccountId) -> String {
/// information to the account now.
pub async fn auto_login(
shared: Arc<Shared>,
pool: &sqlx::AnyPool,
pool: &AnyPool,
user_id: &UserId,
) -> anyhow::Result<bool, AutoLoginError> {
if let Some(account_id) = &user_id.account_id {
let mut pool_con = pool
.acquire()
.await
.map_err(|err| AutoLoginError::Database(err.into()))?;
let con = pool_con
let mut con = pool_con
.acquire()
.await
.map_err(|err| AutoLoginError::Database(err.into()))?;
Expand All @@ -62,8 +61,8 @@ pub async fn auto_login(
};

let res = qry
.query(con, &shared.db.register_user_statement)
.execute(&mut *con)
.query(&shared.db.register_user_statement)
.execute(&mut con)
.await
.map_err(|err| AutoLoginError::Database(err.into()))?;

Expand Down
29 changes: 18 additions & 11 deletions lib/ddnet-account-game-server/src/auto_login/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use anyhow::anyhow;
use async_trait::async_trait;
use ddnet_account_sql::query::Query;
use ddnet_accounts_types::account_id::AccountId;
use sqlx::any::AnyRow;
use sqlx::Executor;
use sqlx::Statement;

Expand All @@ -17,42 +16,50 @@ pub struct RegisterUser<'a> {
}

#[async_trait]
impl<'a> Query<()> for RegisterUser<'a> {
impl Query<()> for RegisterUser<'_> {
#[cfg(feature = "mysql")]
async fn prepare_mysql(
connection: &mut sqlx::AnyConnection,
) -> anyhow::Result<sqlx::any::AnyStatement<'static>> {
connection: &mut sqlx::mysql::MySqlConnection,
) -> anyhow::Result<sqlx::mysql::MySqlStatement<'static>> {
Ok(connection
.prepare(include_str!("mysql/try_insert_user.sql"))
.await?)
}
#[cfg(feature = "sqlite")]
async fn prepare_sqlite(
connection: &mut sqlx::AnyConnection,
) -> anyhow::Result<sqlx::any::AnyStatement<'static>> {
connection: &mut sqlx::sqlite::SqliteConnection,
) -> anyhow::Result<sqlx::sqlite::SqliteStatement<'static>> {
Ok(connection
.prepare(include_str!("sqlite/try_insert_user.sql"))
.await?)
}
#[cfg(feature = "mysql")]
fn query_mysql<'b>(
&'b self,
statement: &'b sqlx::any::AnyStatement<'static>,
) -> sqlx::query::Query<'b, sqlx::Any, sqlx::any::AnyArguments<'b>> {
statement: &'b sqlx::mysql::MySqlStatement<'static>,
) -> sqlx::query::Query<'b, sqlx::MySql, sqlx::mysql::MySqlArguments> {
let account_id = self.account_id;

statement.query().bind(self.default_name).bind(account_id)
}
#[cfg(feature = "sqlite")]
fn query_sqlite<'b>(
&'b self,
statement: &'b sqlx::any::AnyStatement<'static>,
) -> sqlx::query::Query<'b, sqlx::Any, sqlx::any::AnyArguments<'b>> {
statement: &'b sqlx::sqlite::SqliteStatement<'static>,
) -> sqlx::query::Query<'b, sqlx::Sqlite, sqlx::sqlite::SqliteArguments<'b>> {
let account_id = self.account_id;

statement.query().bind(self.default_name).bind(account_id)
}
fn row_data(_row: &AnyRow) -> anyhow::Result<()> {
#[cfg(feature = "mysql")]
fn row_data_mysql(_row: &sqlx::mysql::MySqlRow) -> anyhow::Result<()> {
Err(anyhow!(
"Data rows are not supported for this query.
You probably want to check affected rows instead."
))
}
#[cfg(feature = "sqlite")]
fn row_data_sqlite(_row: &sqlx::sqlite::SqliteRow) -> anyhow::Result<()> {
Err(anyhow!(
"Data rows are not supported for this query.
You probably want to check affected rows instead."
Expand Down
2 changes: 1 addition & 1 deletion lib/ddnet-account-game-server/src/db.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sqlx::any::AnyStatement;
use ddnet_account_sql::any::AnyStatement;

/// Shared data for a db connection
pub struct DbConnectionShared {
Expand Down
13 changes: 6 additions & 7 deletions lib/ddnet-account-game-server/src/prepare.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
use std::sync::Arc;

use ddnet_account_sql::query::Query;
use sqlx::Acquire;
use ddnet_account_sql::{any::AnyPool, query::Query};

use crate::{
auto_login::queries::RegisterUser, db::DbConnectionShared, rename::queries::RenameUser,
shared::Shared,
};

async fn prepare_statements(pool: &sqlx::AnyPool) -> anyhow::Result<DbConnectionShared> {
async fn prepare_statements(pool: &AnyPool) -> anyhow::Result<DbConnectionShared> {
let mut pool_con = pool.acquire().await?;
let con = pool_con.acquire().await?;
let mut con = pool_con.acquire().await?;

Ok(DbConnectionShared {
register_user_statement: RegisterUser::prepare(con).await?,
try_rename_statement: RenameUser::prepare(con).await?,
register_user_statement: RegisterUser::prepare(&mut con).await?,
try_rename_statement: RenameUser::prepare(&mut con).await?,
})
}

/// Prepare shared data used in the game server's implementation
pub async fn prepare(pool: &sqlx::AnyPool) -> anyhow::Result<Arc<Shared>> {
pub async fn prepare(pool: &AnyPool) -> anyhow::Result<Arc<Shared>> {
Ok(Arc::new(Shared {
db: prepare_statements(pool).await?,
}))
Expand Down
Loading

0 comments on commit 830316b

Please sign in to comment.