MCPcopy Create free account
hub / github.com/SapphireServer/Sapphire / insertSession

Function insertSession

src/api/main.cpp:373–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373void insertSession( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer::Request > request )
374{
375 print_request_info( request );
376
377 try
378 {
379 auto json = nlohmann::json::parse( request->content );
380
381 std::string sId = json["sId"];
382 uint32_t accountId = json["accountId"].get< uint32_t >();
383 std::string secret = json["secret"];
384
385 // reloadConfig();
386 if( m_config.global.general.serverSecret != secret )
387 {
388 std::string json_string = "{\"result\":\"invalid_secret\"}";
389 *response << buildHttpResponse( 403, json_string, JSON );
390 }
391 else
392 {
393 g_sapphireAPI.insertSession( accountId, sId );
394 std::string json_string = "{\"result\":\"success\"}";
395 *response << buildHttpResponse( 200, json_string, JSON );
396 }
397 }
398 catch( exception& e )
399 {
400 *response << buildHttpResponse( 500 );
401 Logger::error( e.what() );
402 }
403}
404
405void checkNameTaken( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer::Request > request )
406{

Callers

nothing calls this directly

Calls 5

print_request_infoFunction · 0.85
parseFunction · 0.85
buildHttpResponseFunction · 0.85
insertSessionMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected