55
66bool Auth::GetRiotClientInfo ()
77{
8- std::string auth = utils->WstringToString (GetProcessCommandLine (" RiotClientUx.exe" ));
9- if (auth .empty ())
8+ std::string sAuth = utils->WstringToString (GetProcessCommandLine (" RiotClientUx.exe" ));
9+ if (sAuth .empty ())
1010 {
1111 // MessageBoxA(0, "Client not found", 0, 0);
1212 return 0 ;
1313 }
1414
1515 std::string appPort = " --app-port=" ;
16- size_t nPos = auth .find (appPort);
16+ size_t nPos = sAuth .find (appPort);
1717 if (nPos != std::string::npos)
18- riotPort = std::stoi (auth .substr (nPos + appPort.size (), 5 )); // port is always 5 numbers long
18+ riotPort = std::stoi (sAuth .substr (nPos + appPort.size (), 5 )); // port is always 5 numbers long
1919
2020 std::string remotingAuth = " --remoting-auth-token=" ;
21- nPos = auth .find (remotingAuth) + strlen (remotingAuth.c_str ());
21+ nPos = sAuth .find (remotingAuth) + strlen (remotingAuth.c_str ());
2222 if (nPos != std::string::npos)
2323 {
24- std::string token = " riot:" + auth .substr (nPos, 22 ); // token is always 22 chars long
24+ std::string token = " riot:" + sAuth .substr (nPos, 22 ); // token is always 22 chars long
2525 unsigned char m_Test[50 ];
2626 strncpy ((char *)m_Test, token.c_str (), sizeof (m_Test));
2727 riotToken = base64_encode (m_Test, token.size ()).c_str ();
@@ -44,34 +44,36 @@ void Auth::MakeRiotHeader()
4444 " Connection: keep-alive" + " \n " +
4545 " Authorization: Basic " + riotToken + " \n " +
4646 " Accept: application/json" + " \n " +
47+ " Access-Control-Allow-Credentials: true" + " \n " +
48+ " Access-Control-Allow-Origin: 127.0.0.1" + " \n " +
4749 " Content-Type: application/json" + " \n " +
4850 " Origin: https://127.0.0.1:" + std::to_string (riotPort) + " \n " +
4951 " User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) LeagueOfLegendsClient/11.3.356.7268 (CEF 74) Safari/537.36" + " \n " +
5052 " Referer: https://127.0.0.1:" + std::to_string (riotPort) + " /index.html" + " \n " +
5153 " Accept-Encoding: gzip, deflate, br" + " \n " +
52- " Accept-Language: en-US,en;q=0.8 " ;
54+ " Accept-Language: en-US,en;q=0.9 " ;
5355}
5456
5557bool Auth::GetLeagueClientInfo ()
5658{
5759 // Get client port and auth code from it's command line
58- std::string auth = utils->WstringToString (GetProcessCommandLine (" LeagueClientUx.exe" ));
59- if (auth .empty ())
60+ std::string sAuth = utils->WstringToString (GetProcessCommandLine (" LeagueClientUx.exe" ));
61+ if (sAuth .empty ())
6062 {
6163 // MessageBoxA(0, "Client not found", 0, 0);
6264 return 0 ;
6365 }
6466
6567 std::string appPort = " \" --app-port=" ;
66- size_t nPos = auth .find (appPort);
68+ size_t nPos = sAuth .find (appPort);
6769 if (nPos != std::string::npos)
68- leaguePort = std::stoi (auth .substr (nPos + appPort.size (), 5 ));
70+ leaguePort = std::stoi (sAuth .substr (nPos + appPort.size (), 5 ));
6971
7072 std::string remotingAuth = " --remoting-auth-token=" ;
71- nPos = auth .find (remotingAuth) + strlen (remotingAuth.c_str ());
73+ nPos = sAuth .find (remotingAuth) + strlen (remotingAuth.c_str ());
7274 if (nPos != std::string::npos)
7375 {
74- std::string token = " riot:" + auth .substr (nPos, 22 );
76+ std::string token = " riot:" + sAuth .substr (nPos, 22 );
7577 unsigned char m_Test[50 ];
7678 strncpy ((char *)m_Test, token.c_str (), sizeof (m_Test));
7779 leagueToken = base64_encode (m_Test, token.size ()).c_str ();
0 commit comments