diff --git a/src/routes/register.rs b/src/routes/register.rs index 0086298..a5062c3 100644 --- a/src/routes/register.rs +++ b/src/routes/register.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use axum::{extract::State, Json}; use reqwest::StatusCode; use sea_orm::{EntityTrait, QueryFilter, ColumnTrait, Set, ActiveValue::NotSet}; @@ -12,7 +14,7 @@ pub async fn register_unmigrated(State(state): State, Json(payload): J let form = proto::RefreshRequest { accessToken: payload.token.accessToken, clientToken: payload.token.clientToken, - selectedProfile: None, + selectedProfile: Some(payload.token.selectedProfile.clone()), requestUser: Some(true), }; @@ -48,6 +50,8 @@ pub async fn register_unmigrated(State(state): State, Json(payload): J .map_err(|_| (StatusCode::INTERNAL_SERVER_ERROR, Json(proto::Error::simple("db error"))))? .ok_or((StatusCode::INTERNAL_SERVER_ERROR, Json(proto::Error::simple("failed creating user"))))?; + tokio::time::sleep(Duration::from_millis(500)).await; // avoid errors fetching skin due to timings + let url = format!("https://sessionserver.mojang.com/session/minecraft/profile/{}?unsigned=false", uuid.simple()); let res = reqwest::Client::new().get(url.clone()) //TODO: needs trimmed uuid, is it trimmed by default? .json(&()).send()