summaryrefslogtreecommitdiff
path: root/src/web_service
diff options
context:
space:
mode:
Diffstat (limited to 'src/web_service')
-rw-r--r--src/web_service/announce_room_json.cpp21
-rw-r--r--src/web_service/announce_room_json.h3
-rw-r--r--src/web_service/verify_user_jwt.h2
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) {
19 if (!member.avatar_url.empty()) { 19 if (!member.avatar_url.empty()) {
20 json["avatarUrl"] = member.avatar_url; 20 json["avatarUrl"] = member.avatar_url;
21 } 21 }
22 json["gameName"] = member.game_name; 22 json["gameName"] = member.game.name;
23 json["gameId"] = member.game_id; 23 json["gameId"] = member.game.id;
24} 24}
25 25
26static void from_json(const nlohmann::json& json, Member& member) { 26static void from_json(const nlohmann::json& json, Member& member) {
27 member.nickname = json.at("nickname").get<std::string>(); 27 member.nickname = json.at("nickname").get<std::string>();
28 member.game_name = json.at("gameName").get<std::string>(); 28 member.game.name = json.at("gameName").get<std::string>();
29 member.game_id = json.at("gameId").get<u64>(); 29 member.game.id = json.at("gameId").get<u64>();
30 try { 30 try {
31 member.username = json.at("username").get<std::string>(); 31 member.username = json.at("username").get<std::string>();
32 member.avatar_url = json.at("avatarUrl").get<std::string>(); 32 member.avatar_url = json.at("avatarUrl").get<std::string>();
@@ -42,8 +42,8 @@ static void to_json(nlohmann::json& json, const Room& room) {
42 if (!room.information.description.empty()) { 42 if (!room.information.description.empty()) {
43 json["description"] = room.information.description; 43 json["description"] = room.information.description;
44 } 44 }
45 json["preferredGameName"] = room.information.preferred_game; 45 json["preferredGameName"] = room.information.preferred_game.name;
46 json["preferredGameId"] = room.information.preferred_game_id; 46 json["preferredGameId"] = room.information.preferred_game.id;
47 json["maxPlayers"] = room.information.member_slots; 47 json["maxPlayers"] = room.information.member_slots;
48 json["netVersion"] = room.net_version; 48 json["netVersion"] = room.net_version;
49 json["hasPassword"] = room.has_password; 49 json["hasPassword"] = room.has_password;
@@ -65,8 +65,8 @@ static void from_json(const nlohmann::json& json, Room& room) {
65 } 65 }
66 room.information.host_username = json.at("owner").get<std::string>(); 66 room.information.host_username = json.at("owner").get<std::string>();
67 room.information.port = json.at("port").get<u16>(); 67 room.information.port = json.at("port").get<u16>();
68 room.information.preferred_game = json.at("preferredGameName").get<std::string>(); 68 room.information.preferred_game.name = json.at("preferredGameName").get<std::string>();
69 room.information.preferred_game_id = json.at("preferredGameId").get<u64>(); 69 room.information.preferred_game.id = json.at("preferredGameId").get<u64>();
70 room.information.member_slots = json.at("maxPlayers").get<u32>(); 70 room.information.member_slots = json.at("maxPlayers").get<u32>();
71 room.net_version = json.at("netVersion").get<u32>(); 71 room.net_version = json.at("netVersion").get<u32>();
72 room.has_password = json.at("hasPassword").get<bool>(); 72 room.has_password = json.at("hasPassword").get<bool>();
@@ -83,8 +83,8 @@ namespace WebService {
83 83
84void RoomJson::SetRoomInformation(const std::string& name, const std::string& description, 84void RoomJson::SetRoomInformation(const std::string& name, const std::string& description,
85 const u16 port, const u32 max_player, const u32 net_version, 85 const u16 port, const u32 max_player, const u32 net_version,
86 const bool has_password, const std::string& preferred_game, 86 const bool has_password,
87 const u64 preferred_game_id) { 87 const AnnounceMultiplayerRoom::GameInfo& preferred_game) {
88 room.information.name = name; 88 room.information.name = name;
89 room.information.description = description; 89 room.information.description = description;
90 room.information.port = port; 90 room.information.port = port;
@@ -92,7 +92,6 @@ void RoomJson::SetRoomInformation(const std::string& name, const std::string& de
92 room.net_version = net_version; 92 room.net_version = net_version;
93 room.has_password = has_password; 93 room.has_password = has_password;
94 room.information.preferred_game = preferred_game; 94 room.information.preferred_game = preferred_game;
95 room.information.preferred_game_id = preferred_game_id;
96} 95}
97void RoomJson::AddPlayer(const AnnounceMultiplayerRoom::Member& member) { 96void RoomJson::AddPlayer(const AnnounceMultiplayerRoom::Member& member) {
98 room.members.push_back(member); 97 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:
22 ~RoomJson() = default; 22 ~RoomJson() = default;
23 void SetRoomInformation(const std::string& name, const std::string& description, const u16 port, 23 void SetRoomInformation(const std::string& name, const std::string& description, const u16 port,
24 const u32 max_player, const u32 net_version, const bool has_password, 24 const u32 max_player, const u32 net_version, const bool has_password,
25 const std::string& preferred_game, 25 const AnnounceMultiplayerRoom::GameInfo& preferred_game) override;
26 const u64 preferred_game_id) override;
27 void AddPlayer(const AnnounceMultiplayerRoom::Member& member) override; 26 void AddPlayer(const AnnounceMultiplayerRoom::Member& member) override;
28 WebResult Update() override; 27 WebResult Update() override;
29 WebResult Register() override; 28 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 @@
10 10
11namespace WebService { 11namespace WebService {
12 12
13std::string GetPublicKey(const std::string& host);
14
13class VerifyUserJWT final : public Network::VerifyUser::Backend { 15class VerifyUserJWT final : public Network::VerifyUser::Backend {
14public: 16public:
15 VerifyUserJWT(const std::string& host); 17 VerifyUserJWT(const std::string& host);