diff options
author | german77 <juangerman-13@hotmail.com> | 2022-07-17 22:53:44 -0500 |
---|---|---|
committer | FearlessTobi <thm.frey@gmail.com> | 2022-07-25 21:59:31 +0200 |
commit | 899c8bb33094f43fbd8df9afb4ca84718ebac87e (patch) | |
tree | 392a54ac863f67b37bdfb006f739e8e840a9ab16 /src/web_service | |
parent | 4b404191cf054ec3206676f1fccc452bc0a0e223 (diff) |
common: multiplayer: Use GameInfo type
Diffstat (limited to 'src/web_service')
-rw-r--r-- | src/web_service/announce_room_json.cpp | 21 | ||||
-rw-r--r-- | src/web_service/announce_room_json.h | 3 | ||||
-rw-r--r-- | src/web_service/verify_user_jwt.h | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/web_service/announce_room_json.cpp b/src/web_service/announce_room_json.cpp index 84220b851..082bebaa9 100644 --- a/src/web_service/announce_room_json.cpp +++ b/src/web_service/announce_room_json.cpp @@ -19,14 +19,14 @@ static void to_json(nlohmann::json& json, const Member& member) { if (!member.avatar_url.empty()) { json["avatarUrl"] = member.avatar_url; } - json["gameName"] = member.game_name; - json["gameId"] = member.game_id; + json["gameName"] = member.game.name; + json["gameId"] = member.game.id; } static void from_json(const nlohmann::json& json, Member& member) { member.nickname = json.at("nickname").get<std::string>(); - member.game_name = json.at("gameName").get<std::string>(); - member.game_id = json.at("gameId").get<u64>(); + member.game.name = json.at("gameName").get<std::string>(); + member.game.id = json.at("gameId").get<u64>(); try { member.username = json.at("username").get<std::string>(); member.avatar_url = json.at("avatarUrl").get<std::string>(); @@ -42,8 +42,8 @@ static void to_json(nlohmann::json& json, const Room& room) { if (!room.information.description.empty()) { json["description"] = room.information.description; } - json["preferredGameName"] = room.information.preferred_game; - json["preferredGameId"] = room.information.preferred_game_id; + json["preferredGameName"] = room.information.preferred_game.name; + json["preferredGameId"] = room.information.preferred_game.id; json["maxPlayers"] = room.information.member_slots; json["netVersion"] = room.net_version; json["hasPassword"] = room.has_password; @@ -65,8 +65,8 @@ static void from_json(const nlohmann::json& json, Room& room) { } room.information.host_username = json.at("owner").get<std::string>(); room.information.port = json.at("port").get<u16>(); - room.information.preferred_game = json.at("preferredGameName").get<std::string>(); - room.information.preferred_game_id = json.at("preferredGameId").get<u64>(); + room.information.preferred_game.name = json.at("preferredGameName").get<std::string>(); + room.information.preferred_game.id = json.at("preferredGameId").get<u64>(); room.information.member_slots = json.at("maxPlayers").get<u32>(); room.net_version = json.at("netVersion").get<u32>(); room.has_password = json.at("hasPassword").get<bool>(); @@ -83,8 +83,8 @@ namespace WebService { void RoomJson::SetRoomInformation(const std::string& name, const std::string& description, const u16 port, const u32 max_player, const u32 net_version, - const bool has_password, const std::string& preferred_game, - const u64 preferred_game_id) { + const bool has_password, + const AnnounceMultiplayerRoom::GameInfo& preferred_game) { room.information.name = name; room.information.description = description; room.information.port = port; @@ -92,7 +92,6 @@ void RoomJson::SetRoomInformation(const std::string& name, const std::string& de room.net_version = net_version; room.has_password = has_password; room.information.preferred_game = preferred_game; - room.information.preferred_game_id = preferred_game_id; } void RoomJson::AddPlayer(const AnnounceMultiplayerRoom::Member& member) { room.members.push_back(member); diff --git a/src/web_service/announce_room_json.h b/src/web_service/announce_room_json.h index 811c76fbd..24ec29c65 100644 --- a/src/web_service/announce_room_json.h +++ b/src/web_service/announce_room_json.h @@ -22,8 +22,7 @@ public: ~RoomJson() = default; void SetRoomInformation(const std::string& name, const std::string& description, const u16 port, const u32 max_player, const u32 net_version, const bool has_password, - const std::string& preferred_game, - const u64 preferred_game_id) override; + const AnnounceMultiplayerRoom::GameInfo& preferred_game) override; void AddPlayer(const AnnounceMultiplayerRoom::Member& member) override; WebResult Update() override; WebResult Register() override; diff --git a/src/web_service/verify_user_jwt.h b/src/web_service/verify_user_jwt.h index 826e01eed..6db74c208 100644 --- a/src/web_service/verify_user_jwt.h +++ b/src/web_service/verify_user_jwt.h @@ -10,6 +10,8 @@ namespace WebService { +std::string GetPublicKey(const std::string& host); + class VerifyUserJWT final : public Network::VerifyUser::Backend { public: VerifyUserJWT(const std::string& host); |