Compare commits

..

1 commit

Author SHA1 Message Date
a38c3bd877 Update Rust crate tokio to v1.52.2
All checks were successful
Build and Test / account (push) Successful in 7m47s
2026-05-04 13:15:31 +00:00
3 changed files with 11 additions and 31 deletions

12
Cargo.lock generated
View file

@ -2831,7 +2831,7 @@ dependencies = [
"quinn-udp",
"rustc-hash",
"rustls",
"socket2 0.6.3",
"socket2 0.5.8",
"thiserror 2.0.18",
"tokio",
"tracing",
@ -2869,7 +2869,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.6.3",
"socket2 0.5.8",
"tracing",
"windows-sys 0.59.0",
]
@ -3331,7 +3331,7 @@ dependencies = [
"security-framework 3.7.0",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
"windows-sys 0.52.0",
]
[[package]]
@ -4216,9 +4216,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.52.1"
version = "1.52.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6"
checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386"
dependencies = [
"bytes",
"libc",
@ -4861,7 +4861,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]

4
mii/Cargo.lock generated
View file

@ -1212,9 +1212,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.52.1"
version = "1.52.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6"
checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386"
dependencies = [
"bytes",
"libc",

View file

@ -48,8 +48,7 @@ impl juniper::Context for Context {}
struct TokenInfo {
pid: i32,
expire_date: NaiveDateTime,
title_id: Option<String>,
token_type: i32
title_id: Option<String>
}
#[derive(GraphQLObject)]
@ -61,16 +60,6 @@ struct UserInfo {
mii_data: String,
}
#[derive(GraphQLObject)]
#[graphql(description = "User information from a token")]
struct TokenUserInfo {
username: String,
account_level: i32,
nex_password: String,
mii_data: String,
token_type: i32,
}
#[derive(GraphQLObject)]
#[graphql(description = "User information from a username")]
pub struct UserInfoWithPId {
@ -107,14 +96,13 @@ impl Query {
pid: data.pid,
expire_date: token_info.expires,
title_id: token_info.title_id,
token_type: token_info.token_type,
})
}
async fn user_from_token(
token_data: String,
context: &Context,
) -> Option<TokenUserInfo> {
) -> Option<UserInfo> {
let data = match TokenData::decode(&token_data) {
Some(data) => data,
None => {
@ -123,13 +111,6 @@ impl Query {
}
};
let token_info =
sqlx::query!(
"select * from tokens where pid = $1 and token_id = $2 and random = $3",
data.pid, data.token_id, data.random
).
fetch_one(&context.pool).await.ok()?;
let user = match sqlx::query!(
"SELECT username, account_level, nex_password, mii_data FROM users WHERE pid = $1",
data.pid
@ -146,12 +127,11 @@ impl Query {
let nex_password = user.nex_password;
Some(TokenUserInfo {
Some(UserInfo {
username: user.username,
account_level: user.account_level,
nex_password,
mii_data: user.mii_data.replace('\n', "").replace('\r', ""),
token_type: token_info.token_type
})
}