feat(backend): remove server play analytics fallback (#5884)

Remove server play analytics fallback
This commit is contained in:
Arthur
2026-05-03 14:50:23 +02:00
committed by GitHub
parent 5b59e39a8a
commit f857d19aee

View File

@@ -252,9 +252,8 @@ struct MinecraftProfile {
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct MinecraftJavaServerPlayInput { pub struct MinecraftJavaServerPlayInput {
project_id: ProjectId, project_id: ProjectId,
username: Option<String>, username: String,
server_id: Option<String>, server_id: String,
minecraft_uuid: Option<Uuid>,
} }
pub const MINECRAFT_SERVER_PLAYS: &str = "minecraft_server_plays"; pub const MINECRAFT_SERVER_PLAYS: &str = "minecraft_server_plays";
@@ -292,14 +291,11 @@ async fn minecraft_server_play_ingest(
))); )));
} }
let minecraft_uuid = if let (Some(username), Some(server_id)) =
(&play_input.username, &play_input.server_id)
{
let has_joined = http let has_joined = http
.get("https://sessionserver.mojang.com/session/minecraft/hasJoined") .get("https://sessionserver.mojang.com/session/minecraft/hasJoined")
.query(&[ .query(&[
("username", username.as_str()), ("username", play_input.username.as_str()),
("serverId", server_id.as_str()), ("serverId", play_input.server_id.as_str()),
]) ])
.send() .send()
.await .await
@@ -318,18 +314,13 @@ async fn minecraft_server_play_ingest(
.await .await
.wrap_internal_err("invalid Mojang session response")?; .wrap_internal_err("invalid Mojang session response")?;
if profile.name != *username { if profile.name != play_input.username {
return Err(ApiError::Request(eyre!( return Err(ApiError::Request(eyre!(
"returned Mojang profile name does not match username" "returned Mojang profile name does not match username"
))); )));
} }
profile.id let minecraft_uuid = profile.id;
} else {
play_input
.minecraft_uuid
.wrap_request_err("missing `minecraft_uuid`")?
};
let conn_info = req.connection_info().peer_addr().map(|x| x.to_string()); let conn_info = req.connection_info().peer_addr().map(|x| x.to_string());
let headers = req let headers = req