Multiple merge fixes, rebase, working Https::GET

This commit is contained in:
Lion Kortlepel
2021-08-17 14:33:03 +02:00
parent 5742ab0dad
commit 6462636b29
7 changed files with 50 additions and 128 deletions

View File

@@ -21,6 +21,7 @@ struct Version {
uint8_t minor;
uint8_t patch;
Version(uint8_t major, uint8_t minor, uint8_t patch);
Version(const std::array<uint8_t, 3>& v);
std::string AsString();
};
@@ -81,8 +82,8 @@ public:
static std::string GetBackup2Hostname() { return "backup2.beammp.com"; }
static std::string GetBackendUrlForSocketIO() { return "https://backend.beammp.com"; }
static void CheckForUpdates();
static std::array<int, 3> VersionStrToInts(const std::string& str);
static bool IsOutdated(const std::array<int, 3>& Current, const std::array<int, 3>& Newest);
static std::array<uint8_t, 3> VersionStrToInts(const std::string& str);
static bool IsOutdated(const Version& Current, const Version& Newest);
private:
static inline std::string mPPS;
@@ -163,4 +164,4 @@ void LogChatMessage(const std::string& name, int id, const std::string& msg);
std::string Comp(std::string Data);
std::string DeComp(std::string Compressed);
std::string GetPlatformAgnosticErrorString();
std::string GetPlatformAgnosticErrorString();

View File

@@ -5,8 +5,9 @@
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, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, bool json, int* status = nullptr);
std::string POST(const std::string& host, int port, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, const std::string& ContentType, unsigned int* status = nullptr);
namespace Status {
std::string ToString(int code);
}
}
const std::string ErrorString = "-1";
}