Update SyncbackRequest structure and API protocol validation

- Changed the `protocol_version` and `place_id` fields in the `SyncbackRequest` struct from `u64` to `f64` to accommodate Luau's numeric representation.
- Updated the API's protocol version validation to compare the `syncback_request.protocol_version` as a `u64`, ensuring compatibility with the expected protocol version.
- Enhanced type handling for `place_id` to maintain consistency in the syncback process.

These changes improve the handling of numeric fields in syncback requests, aligning with the requirements of the Luau environment.
This commit is contained in:
Joe 2026-02-18 05:32:46 -06:00
parent fa2b86c3d9
commit 372a422b3d
2 changed files with 10 additions and 5 deletions

View file

@ -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(