| 7 | { |
| 8 | public: |
| 9 | static void Custom() |
| 10 | { |
| 11 | static bool once = true; |
| 12 | |
| 13 | static char method[50]; |
| 14 | static char urlText[1024 * 16]; |
| 15 | static char requestText[1024 * 32]; |
| 16 | |
| 17 | static char inputPort[64] = ""; |
| 18 | static char inputHeader[1024 * 16]; |
| 19 | |
| 20 | static std::string customHeader = LCU::league.header; |
| 21 | static int customPort = LCU::league.port; |
| 22 | |
| 23 | static bool isCustomOpen = false; |
| 24 | |
| 25 | static std::string ledgeUrl; |
| 26 | static std::string storeUrl; |
| 27 | static std::string localhostUrl = "https://127.0.0.1"; |
| 28 | |
| 29 | if (once) |
| 30 | { |
| 31 | once = false; |
| 32 | std::ranges::copy(S.customTab.method, method); |
| 33 | std::ranges::copy(S.customTab.urlText, urlText); |
| 34 | std::ranges::copy(S.customTab.requestText, requestText); |
| 35 | std::ranges::copy(S.customTab.port, inputPort); |
| 36 | std::ranges::copy(S.customTab.header, inputHeader); |
| 37 | } |
| 38 | |
| 39 | if (onOpen) |
| 40 | { |
| 41 | customHeader = LCU::league.header; |
| 42 | customPort = LCU::league.port; |
| 43 | |
| 44 | ledgeUrl = GetLedgeUrl(); |
| 45 | storeUrl = LCU::Request("GET", "/lol-store/v1/getStoreUrl"); |
| 46 | std::erase(storeUrl, '"'); |
| 47 | } |
| 48 | |
| 49 | ImGui::Text("Method:"); |
| 50 | const ImVec2 label_size = ImGui::CalcTextSize("W", nullptr, true); |
| 51 | ImGui::InputTextEx("##inputMethod", nullptr, method, IM_ARRAYSIZE(method), |
| 52 | ImVec2(S.Window.width - 130.f, label_size.y + ImGui::GetStyle().FramePadding.y * 2.0f), 0, nullptr, nullptr); |
| 53 | |
| 54 | ImGui::Text("URL:"); |
| 55 | ImGui::InputTextMultiline("##inputUrl", urlText, IM_ARRAYSIZE(urlText), |
| 56 | ImVec2(S.Window.width - 130.f, label_size.y + ImGui::GetStyle().FramePadding.y * 2.0f)); |
| 57 | |
| 58 | ImGui::Text("Body:"); |
| 59 | ImGui::InputTextMultiline("##inputBody", (requestText), IM_ARRAYSIZE(requestText), ImVec2(S.Window.width - 130.f, |
| 60 | (label_size.y + ImGui::GetStyle().FramePadding.y) * |
| 61 | 6.f), ImGuiInputTextFlags_AllowTabInput); |
| 62 | |
| 63 | S.customTab.method = method; |
| 64 | S.customTab.urlText = urlText; |
| 65 | S.customTab.requestText = requestText; |
| 66 | |