From 80675338afc261a201e23ce1736c80b77a21642f Mon Sep 17 00:00:00 2001 From: "dev@ftbsc" Date: Sun, 22 Jan 2023 20:25:29 +0100 Subject: [PATCH] chore: added logging to MS fallback --- src/routes/session.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/routes/session.rs b/src/routes/session.rs index 1037c7d..9b55f96 100644 --- a/src/routes/session.rs +++ b/src/routes/session.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use axum::{extract::{State, Query, Path}, http::StatusCode, Json}; use chrono::{Duration, Utc}; use sea_orm::{ColumnTrait, EntityTrait, QueryFilter}; -use tracing::{info, warn}; +use tracing::{info, warn, error}; use uuid::Uuid; use crate::{AppState, proto, JoinAttempt, entities}; @@ -47,14 +47,14 @@ pub async fn has_joined_wrapper(State(state): State, Query(query): Que } pub async fn has_joined_microsoft(_state: &AppState, username: &String, server_id: &String, _user_ip: Option<&String>) -> Result, StatusCode> { - Ok( - Json( // TODO don't do it with a format!!! + info!(target: "SESSION", "[HAS_JOINED] falling back to MS"); + let res = // TODO don't do it with a format!!! reqwest::get(format!("https://sessionserver.mojang.com/session/minecraft/hasJoined?username={}&serverId={}", username, server_id)) - .await.map_err(|_| StatusCode::SERVICE_UNAVAILABLE)? + .await.map_err(|e| { error!(target:"MS", "error before: {:?}", e); StatusCode::SERVICE_UNAVAILABLE })? .json::() - .await.map_err(|_| StatusCode::UNAUTHORIZED)? - ) - ) + .await.map_err(|e| { error!(target:"MS", "error after: {:?}", e); StatusCode::UNAUTHORIZED })?; + info!(target:"MS", "answering with {:?}", res); + Ok(Json(res)) } pub async fn has_joined_local(state: &AppState, username: &String, server_id: &String, user_ip: Option<&String>) -> Result, StatusCode> {