From 5c5e878ceacc20063d9437fd6efecab5a6eedc8e Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 9 May 2023 01:45:41 +0200 Subject: [PATCH] fix: small delay during registration, send profile --- src/routes/register.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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()