Switch to curl

This commit is contained in:
Tixx
2025-01-09 08:05:05 +01:00
parent d7e75ae0c7
commit 26f1be0a51
5 changed files with 74 additions and 54 deletions

View File

@@ -82,11 +82,11 @@ public:
static std::vector<std::string> GetBackendUrlsInOrder() {
return {
"backend.beammp.com",
"https://backend.beammp.com",
};
}
static std::string GetBackendUrlForAuth() { return "auth.beammp.com"; }
static std::string GetBackendUrlForAuth() { return "https://auth.beammp.com"; }
static std::string GetBackendUrlForSocketIO() { return "https://backend.beammp.com"; }
static void CheckForUpdates();
static std::array<uint8_t, 3> VersionStrToInts(const std::string& str);

View File

@@ -23,6 +23,7 @@
#include <filesystem>
#include <string>
#include <unordered_map>
#include <curl/curl.h>
#if defined(BEAMMP_LINUX)
#pragma GCC diagnostic push
@@ -38,8 +39,8 @@
namespace fs = std::filesystem;
namespace Http {
std::string GET(const std::string& host, int port, const std::string& target, unsigned int* status = nullptr);
std::string POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status = nullptr, const httplib::Headers& headers = {});
std::string GET(const std::string& url, unsigned int* status = nullptr);
std::string POST(const std::string& url, const std::string& body, const std::string& ContentType, unsigned int* status = nullptr, const std::map<std::string, std::string>& headers = {});
namespace Status {
std::string ToString(int code);
}