diff --git a/src/web/api.rs b/src/web/api.rs index c40f16cc..78301414 100644 --- a/src/web/api.rs +++ b/src/web/api.rs @@ -194,11 +194,12 @@ async fn handle_api_syncback( } }; - if syncback_request.protocol_version != PROTOCOL_VERSION { + let client_protocol = syncback_request.protocol_version as u64; + if client_protocol != PROTOCOL_VERSION { return msgpack( ErrorResponse::bad_request(format!( "Protocol version mismatch: expected {}, got {}", - PROTOCOL_VERSION, syncback_request.protocol_version + PROTOCOL_VERSION, client_protocol )), StatusCode::BAD_REQUEST, ); @@ -219,7 +220,8 @@ async fn handle_api_syncback( ); } - if let Some(place_id) = syncback_request.place_id { + if let Some(place_id_f64) = syncback_request.place_id { + let place_id = place_id_f64 as u64; if let Some(expected) = service.serve_session.serve_place_ids() { if !expected.contains(&place_id) { return msgpack( diff --git a/src/web/interface.rs b/src/web/interface.rs index 4fa7b796..2f0a27fb 100644 --- a/src/web/interface.rs +++ b/src/web/interface.rs @@ -37,12 +37,15 @@ pub struct ServiceChunk { } /// Incoming request from the plugin for live syncback. +/// Numeric fields use `f64` because Luau has no integer type -- all numbers +/// are IEEE 754 doubles, and large values (like place IDs) get encoded as +/// msgpack float64 which rmp_serde cannot coerce into u64. #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SyncbackRequest { - pub protocol_version: u64, + pub protocol_version: f64, pub server_version: String, - pub place_id: Option, + pub place_id: Option, pub services: Vec, }