feat(server): check for version in update requests

This commit is contained in:
Anna 2023-10-07 04:46:37 -04:00
parent 8e09ae2c22
commit 3a28523612
Signed by: anna
GPG Key ID: D0943384CD9F87D1
1 changed files with 5 additions and 0 deletions

View File

@ -181,6 +181,10 @@ async fn upload(
state: State<Arc<AppState>>,
data: MsgPack<Update>,
) -> Result<(), AppError> {
if data.version != 2 {
return Err(anyhow::anyhow!("invalid update request version").into());
}
let mut t = state.pool.begin().await?;
for player in &data.players {
@ -253,6 +257,7 @@ async fn upload(
#[derive(Deserialize)]
struct Update {
version: u8,
territory: u32,
world: u32,
players: Vec<PlayerInfo>,