mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	citra-room: Add verify backend and use new announce api
This commit is contained in:
		
							parent
							
								
									e04f75e1bf
								
							
						
					
					
						commit
						4906c8ce7b
					
				
					 2 changed files with 24 additions and 1 deletions
				
			
		|  | @ -8,6 +8,11 @@ add_executable(citra-room | ||||||
| create_target_directory_groups(citra-room) | create_target_directory_groups(citra-room) | ||||||
| 
 | 
 | ||||||
| target_link_libraries(citra-room PRIVATE common core network) | target_link_libraries(citra-room PRIVATE common core network) | ||||||
|  | if (ENABLE_WEB_SERVICE) | ||||||
|  |     target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE) | ||||||
|  |     target_link_libraries(citra-room PRIVATE web_service) | ||||||
|  | endif() | ||||||
|  | 
 | ||||||
| target_link_libraries(citra-room PRIVATE glad) | target_link_libraries(citra-room PRIVATE glad) | ||||||
| if (MSVC) | if (MSVC) | ||||||
|     target_link_libraries(citra-room PRIVATE getopt) |     target_link_libraries(citra-room PRIVATE getopt) | ||||||
|  |  | ||||||
|  | @ -31,6 +31,11 @@ | ||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/settings.h" | #include "core/settings.h" | ||||||
| #include "network/network.h" | #include "network/network.h" | ||||||
|  | #include "network/verify_user.h" | ||||||
|  | 
 | ||||||
|  | #ifdef ENABLE_WEB_SERVICE | ||||||
|  | #include "web_service/verify_user_jwt.h" | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| static void PrintHelp(const char* argv0) { | static void PrintHelp(const char* argv0) { | ||||||
|     std::cout << "Usage: " << argv0 |     std::cout << "Usage: " << argv0 | ||||||
|  | @ -179,10 +184,23 @@ int main(int argc, char** argv) { | ||||||
|         Settings::values.citra_token = token; |         Settings::values.citra_token = token; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     std::unique_ptr<Network::VerifyUser::Backend> verify_backend; | ||||||
|  |     if (announce) { | ||||||
|  | #ifdef ENABLE_WEB_SERVICE | ||||||
|  |         verify_backend = std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url); | ||||||
|  | #else | ||||||
|  |         std::cout | ||||||
|  |             << "Citra Web Services is not available with this build: validation is disabled.\n\n"; | ||||||
|  |         verify_backend = std::make_unique<Network::VerifyUser::NullBackend>(); | ||||||
|  | #endif | ||||||
|  |     } else { | ||||||
|  |         verify_backend = std::make_unique<Network::VerifyUser::NullBackend>(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     Network::Init(); |     Network::Init(); | ||||||
|     if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) { |     if (std::shared_ptr<Network::Room> room = Network::GetRoom().lock()) { | ||||||
|         if (!room->Create(room_name, room_description, "", port, password, max_members, |         if (!room->Create(room_name, room_description, "", port, password, max_members, | ||||||
|                           preferred_game, preferred_game_id)) { |                           preferred_game, preferred_game_id, std::move(verify_backend))) { | ||||||
|             std::cout << "Failed to create room: \n\n"; |             std::cout << "Failed to create room: \n\n"; | ||||||
|             return -1; |             return -1; | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue