Validate the dist value server-side rather than client-side.

This commit is contained in:
Pentarctagon 2020-01-17 10:15:47 -06:00 committed by Pentarctagon
parent 719e4f2a7f
commit 288e859b7c
2 changed files with 7 additions and 8 deletions

View File

@ -155,14 +155,7 @@ std::pair<wesnothd_connection_ptr, config> open_connection(std::string host)
if(infofile.is_open()){
infofile >> info;
infofile.close();
if(info == "Default" || info == "Steam" || info == "SourceForge" || info == "Flatpak"
|| info == "macOS App Store" || info == "Linux repository" || info == "iOS" || info == "Android"
|| info == "BSD repository") {
cfg["client_source"] = info;
} else {
cfg["client_source"] = "Default";
}
cfg["client_source"] = info;
} else {
cfg["client_source"] = "Default";
}

View File

@ -1636,6 +1636,12 @@ void server::handle_player_in_game(socket_ptr socket, std::shared_ptr<simple_wml
} else {
version = player->info().version();
source = player->info().source();
if(source != "Default" && source != "Steam" && source != "SourceForge" && source != "Flatpak"
&& source != "macOS App Store" && source != "Linux repository" && source != "iOS" && source != "Android"
&& source != "BSD repository") {
source = "Default";
}
}
user_handler_->db_insert_game_player_info(uuid_, g.id(), side["player_id"].to_string(), side["side"].to_int(), side["is_host"].to_bool(), side["faction"].to_string(), version, source, side["current_player"].to_string());
}