Skip to content

Commit 6d9665e

Browse files
committed
fix crashes, add disconnect from chat
1 parent ee9a65e commit 6d9665e

File tree

7 files changed

+106
-60
lines changed

7 files changed

+106
-60
lines changed

KBotExt/KBotExt.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@
145145
<EnableModules>true</EnableModules>
146146
<FloatingPointModel>
147147
</FloatingPointModel>
148+
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
149+
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
150+
<FunctionLevelLinking>true</FunctionLevelLinking>
148151
</ClCompile>
149152
<Link>
150153
<SubSystem>Windows</SubSystem>

KBotExt/LoginTab.h

Lines changed: 62 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -302,61 +302,68 @@ class LoginTab
302302

303303
if (ImGui::Button("Get email"))
304304
{
305-
cpr::Session session;
306-
cpr::Header authHeader = {
307-
{"Content-Type", "application/json"},
308-
{"Accept-Encoding", "deflate"},
309-
{"Upgrade-Insecure-Requests", "1"},
310-
{"sec-ch-ua", R"("Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115")"},
311-
{"sec-ch-ua-platform", "\"Windows\""},
312-
{"sec-ch-ua-mobile", "?0"},
313-
{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"},
314-
{"Sec-Fetch-Site", "cross-site"},
315-
{"Sec-Fetch-Mode", "navigate"},
316-
{"Sec-Fetch-Dest", "document"},
317-
{"Accept-Language", "en-US,en;q=0.9"},
318-
{
319-
"Accept",
320-
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
321-
},
322-
{"Referer", "https://riotgames.zendesk.com/"},
323-
};
324-
session.SetHeader(authHeader);
325-
326-
session.SetUrl(
327-
"https://auth.riotgames.com/authorize?redirect_uri=https://login.playersupport.riotgames.com/login_callback&client_id=player-support-zendesk&ui_locales=en-us%20en-us&response_type=code&scope=openid%20email");
328-
session.Get();
329-
330-
Json::Value authData2;
331-
authData2["language"] = "en_GB";
332-
authData2["password"] = password;
333-
authData2["region"] = Json::nullValue;
334-
authData2["remember"] = false;
335-
authData2["type"] = "auth";
336-
authData2["username"] = username;
337-
338-
session.SetBody(authData2.toStyledString());
339-
session.SetUrl("https://auth.riotgames.com/api/v1/authorization");
340-
std::string r = session.Put().text;
341-
342-
Json::CharReaderBuilder builder;
343-
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
344-
JSONCPP_STRING err;
345-
Json::Value rootAuth;
346-
banCheck = r;
347-
if (r.find("\"error\"") == std::string::npos && reader->parse(r.c_str(), r.c_str() + static_cast<int>(r.length()), &rootAuth, &err))
348-
{
349-
session.SetUrl(rootAuth["response"]["parameters"]["uri"].asString());
350-
session.Get().text; // UnusedValue
351-
352-
session.SetUrl("https://support-leagueoflegends.riotgames.com/hc/en-us/requests");
353-
std::string support = session.Get().text;
354-
std::regex regexStr("\"email\":(.*?),");
355-
if (std::smatch m; std::regex_search(support, m, regexStr))
356-
{
357-
banCheck = m.str();
358-
}
359-
}
305+
MessageBoxA(nullptr, "Login\nClick on 'My Tickets'\nCtrl+Shift+I\nCtrl+F and search for \"email\"", "Info", MB_OK | MB_SETFOREGROUND);
306+
307+
Utils::OpenUrl(L"https://auth.riotgames.com/authorize?redirect_uri=https://login.playersupport.riotgames.com/login_callback&client_id=player-support-zendesk&ui_locales=en-us%20en-us&response_type=code&scope=openid%20email"
308+
, nullptr, SW_SHOW);
309+
310+
// Outdated, new login endpoints require captcha
311+
//
312+
//cpr::Session session;
313+
//cpr::Header authHeader = {
314+
// {"Content-Type", "application/json"},
315+
// {"Accept-Encoding", "deflate"},
316+
// {"Upgrade-Insecure-Requests", "1"},
317+
// {"sec-ch-ua", R"("Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115")"},
318+
// {"sec-ch-ua-platform", "\"Windows\""},
319+
// {"sec-ch-ua-mobile", "?0"},
320+
// {"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"},
321+
// {"Sec-Fetch-Site", "cross-site"},
322+
// {"Sec-Fetch-Mode", "navigate"},
323+
// {"Sec-Fetch-Dest", "document"},
324+
// {"Accept-Language", "en-US,en;q=0.9"},
325+
// {
326+
// "Accept",
327+
// "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
328+
// },
329+
// {"Referer", "https://riotgames.zendesk.com/"},
330+
//};
331+
//session.SetHeader(authHeader);
332+
333+
//session.SetUrl(
334+
// "https://auth.riotgames.com/authorize?redirect_uri=https://login.playersupport.riotgames.com/login_callback&client_id=player-support-zendesk&ui_locales=en-us%20en-us&response_type=code&scope=openid%20email");
335+
//session.Get();
336+
337+
//Json::Value authData2;
338+
//authData2["language"] = "en_GB";
339+
//authData2["password"] = password;
340+
//authData2["region"] = Json::nullValue;
341+
//authData2["remember"] = false;
342+
//authData2["type"] = "auth";
343+
//authData2["username"] = username;
344+
345+
//session.SetBody(authData2.toStyledString());
346+
//session.SetUrl("https://auth.riotgames.com/api/v1/authorization");
347+
//std::string r = session.Put().text;
348+
349+
//Json::CharReaderBuilder builder;
350+
//const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
351+
//JSONCPP_STRING err;
352+
//Json::Value rootAuth;
353+
//banCheck = r;
354+
//if (r.find("\"error\"") == std::string::npos && reader->parse(r.c_str(), r.c_str() + static_cast<int>(r.length()), &rootAuth, &err))
355+
//{
356+
// session.SetUrl(rootAuth["response"]["parameters"]["uri"].asString());
357+
// session.Get().text; // UnusedValue
358+
359+
// session.SetUrl("https://support-leagueoflegends.riotgames.com/hc/en-us/requests");
360+
// std::string support = session.Get().text;
361+
// std::regex regexStr("\"email\":(.*?),");
362+
// if (std::smatch m; std::regex_search(support, m, regexStr))
363+
// {
364+
// banCheck = m.str();
365+
// }
366+
//}
360367
}
361368

362369
ImGui::Columns(1);

KBotExt/Misc.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class Misc
2121
{
2222
public:
23-
static inline std::string programVersion = "1.5.5";
23+
static inline std::string programVersion = "1.5.6";
2424
static inline std::string latestVersion;
2525

2626
static bool LaunchClient(const std::string& args)
@@ -201,10 +201,10 @@ class Misc
201201
if (currentSkin["isBase"].asBool() == true)
202202
{
203203
champs[champName].name = champName;
204-
205-
std::string splashPath = currentSkin["splashPath"].asString();
206-
size_t keyStart = splashPath.find("champion-splashes/") + strlen("champion-splashes/");
207-
std::string champKey = splashPath.substr(keyStart, splashPath.find("/", keyStart) - keyStart);
204+
std::string champKey = id;
205+
if (champKey.size() >= 3 && champKey.substr(champKey.size() - 3) == "000") {
206+
champKey.erase(champKey.size() - 3);
207+
}
208208

209209
champs[champName].key = std::stoi(champKey);
210210
skin.first = id;
@@ -246,8 +246,10 @@ class Misc
246246
L"RiotClientServices.exe",
247247
L"RiotClientUx.exe",
248248
L"RiotClientUxRender.exe",
249+
L"Riot Client.exe",
249250

250251
L"LeagueCrashHandler.exe",
252+
L"LeagueCrashHandler64.exe",
251253
L"LeagueClient.exe",
252254
L"LeagueClientUx.exe",
253255
L"LeagueClientUxRender.exe"

KBotExt/MiscTab.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,14 @@ class MiscTab
504504
}
505505
}
506506

507+
if (ImGui::Button("Get email"))
508+
{
509+
MessageBoxA(nullptr, "Login\nClick on 'My Tickets'\nCtrl+Shift+I\nCtrl+F and search for \"email\"", "Info", MB_OK | MB_SETFOREGROUND);
510+
511+
Utils::OpenUrl(L"https://auth.riotgames.com/authorize?redirect_uri=https://login.playersupport.riotgames.com/login_callback&client_id=player-support-zendesk&ui_locales=en-us%20en-us&response_type=code&scope=openid%20email"
512+
, nullptr, SW_SHOW);
513+
}
514+
507515
// if (ImGui::Button("Tournament of Souls - unlock all"))
508516
// {
509517
// LCU::Request("POST", "/lol-marketing-preferences/v1/partition/sfm2023", R"({

KBotExt/ProfileTab.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ class ProfileTab
7171
LCU::Request("PUT", "https://127.0.0.1/lol-chat/v1/me", body);
7272
}
7373

74+
ImGui::SameLine();
75+
ImGui::Text("\t ");
76+
ImGui::SameLine();
77+
if (ImGui::Button("Disconnect from chat"))
78+
{
79+
LCU::SetCurrentClientRiotInfo();
80+
cpr::Post(cpr::Url{ std::format("https://127.0.0.1:{}/chat/v1/suspend", LCU::riot.port) },
81+
cpr::Body{ "{\"config\":\"disable\"}" },
82+
cpr::Header{ Utils::StringToHeader(LCU::riot.header) }, cpr::VerifySsl{ false });
83+
}
84+
85+
ImGui::SameLine();
86+
if (ImGui::Button("Reconnect to chat"))
87+
{
88+
LCU::SetCurrentClientRiotInfo();
89+
cpr::Post(cpr::Url{ std::format("https://127.0.0.1:{}/chat/v1/resume", LCU::riot.port) },
90+
cpr::Header{ Utils::StringToHeader(LCU::riot.header) }, cpr::VerifySsl{ false });
91+
}
92+
7493
ImGui::Separator();
7594

7695
ImGui::Text("Rank:");

KBotExt/SettingsTab.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ class SettingsTab
235235
Misc::programVersion.c_str(), Misc::latestVersion.c_str());
236236
ImGui::Text("GitHub repository:");
237237
ImGui::TextURL("Click me!", "https://github.com/KebsCS/KBotExt", 1, 0);
238+
ImGui::SameLine();
239+
ImGui::Text("| Discord server:");
240+
ImGui::TextURL("Click me!", "https://discord.gg/qMmPBFpj2n", 1, 0);
238241

239242
if (!result.empty())
240243
ImGui::Separator();

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@
6565
3. Set the solution platform to x64 Release
6666
4. Build the project
6767
5. Feel free to make a pull request with your changes :-)
68+
69+
70+
## Discord
71+
Feel free to ask any questions regarding this project, or league client on my [discord server](https://discord.gg/qMmPBFpj2n), although I won't be teaching you how to code there if you're a complete beginner

0 commit comments

Comments
 (0)