Give WinsockNetLayer::DoWinHttpRequest a url instead of it just being 1
This commit is contained in:
@@ -1735,7 +1735,7 @@ DWORD WINAPI WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HttpResponse WinsockNetLayer::DoWinHttpRequest(const std::wstring& path, const wchar_t* method, const std::string& requestData, const std::vector<std::wstring>& headers)
|
||||
HttpResponse WinsockNetLayer::DoWinHttpRequest(const std::wstring& url, const std::wstring& path, const wchar_t* method, const std::string& requestData, const std::vector<std::wstring>& headers)
|
||||
{
|
||||
HttpResponse response;
|
||||
response.status = 0;
|
||||
@@ -1743,7 +1743,7 @@ HttpResponse WinsockNetLayer::DoWinHttpRequest(const std::wstring& path, const w
|
||||
HINTERNET hSession = WinHttpOpen(L"Minecraft Client", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
|
||||
if (!hSession) return response;
|
||||
|
||||
HINTERNET hConnect = WinHttpConnect(hSession, g_Win64AuthIP, 443, 0);
|
||||
HINTERNET hConnect = WinHttpConnect(hSession, url.c_str(), 443, 0);
|
||||
if (!hConnect) { WinHttpCloseHandle(hSession); return response; }
|
||||
|
||||
HINTERNET hRequest = WinHttpOpenRequest(hConnect, method, path.c_str(), NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_SECURE);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
float g_sleepPercentage = 100;
|
||||
int g_autosaveInterval = 120;
|
||||
|
||||
wchar_t g_Win64AuthURL[256] = L"auth.mclegacyedition.xyz";
|
||||
|
||||
std::string g_discordUserId = "";
|
||||
|
||||
bool g_doBoatBreak = true;
|
||||
@@ -658,7 +660,7 @@ int Windows64Launcher::API_GetAccountInfo(const std::string token) {
|
||||
std::vector<std::wstring> headers;
|
||||
headers.push_back(L"Content-Type: text/plain");
|
||||
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"/accountinfo", L"POST", token, headers);
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(g_Win64AuthURL, L"/accountinfo", L"POST", token, headers);
|
||||
|
||||
if (response.status == 0) return -1;
|
||||
|
||||
@@ -677,7 +679,7 @@ int Windows64Launcher::API_AttemptAccountRegister(const std::string _username, c
|
||||
|
||||
std::string data = _username + ":" + password;
|
||||
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"/register", L"POST", data, headers);
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(g_Win64AuthURL, L"/register", L"POST", data, headers);
|
||||
|
||||
if (response.status != 200) return (20000 + response.status);
|
||||
|
||||
@@ -698,7 +700,7 @@ int Windows64Launcher::API_AttemptAccountLogin(const std::string _username, cons
|
||||
|
||||
std::string data = _username + ":" + password;
|
||||
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"/login", L"POST", data, headers);
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(g_Win64AuthURL, L"/login", L"POST", data, headers);
|
||||
|
||||
if (response.status != 200) return (20000 + response.status);
|
||||
|
||||
@@ -716,7 +718,7 @@ int Windows64Launcher::API_AttemptDiscordLogin(const std::string& ticket, std::s
|
||||
std::vector<std::wstring> headers;
|
||||
headers.push_back(L"Content-Type: text/plain");
|
||||
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"/discordlogin", L"POST", ticket, headers);
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(g_Win64AuthURL, L"/discordlogin", L"POST", ticket, headers);
|
||||
|
||||
if (response.status == 0) return -1;
|
||||
if (response.status != 200) return (20000 + response.status);
|
||||
|
||||
@@ -148,7 +148,7 @@ static bool FetchSessionInfo() {
|
||||
std::vector<std::wstring> headers;
|
||||
headers.push_back(L"Content-Type: text/plain");
|
||||
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"/accountinfo", L"POST", Windows64Minecraft::GetAuthenticationTicket(), headers);
|
||||
HttpResponse response = WinsockNetLayer::DoWinHttpRequest(L"auth.mclegacyedition.xyz", L"/accountinfo", L"POST", Windows64Minecraft::GetAuthenticationTicket(), headers);
|
||||
|
||||
if (response.status == 0) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user